Rockbox Technical Forums

Support and General Use => Recording => Topic started by: lenny on December 10, 2005, 08:16:12 PM

Title: New recording idea, a bit crazy
Post by: lenny on December 10, 2005, 08:16:12 PM
Well I was playing guitar while thinking about that plugin I found awhile back that was basically a drum machine (what ever happened to that anyway?) and I got this crazy idea.

I think somebody (I wish I could) should write a multi-track recording program for rockbox. You could have multiple channels for which you could either record to or simultaneously play back. You could only record to one channel at a time of course, but depending on how effecient the rockbox wav playing and recording routines are, theoretically could they be done simultaneously?

One more thing, humor me please. If I were to say that I wanted to learn how to program just so I could write this thing I'm dreaming up, what would I need to learn and how long would it take me to do learn so I could write this assuming I've got a good head on my shoulders? (the most complex I ever got language wise was php)

So, what does anybody think about my idea?
Title: Re: New recording idea, a bit crazy
Post by: OtisFunkmeyer on December 13, 2005, 07:05:02 AM
I think it's a great idea.  I even think it would be possible to get music editing software in there too. :)
Title: Re: New recording idea, a bit crazy
Post by: MoAv on December 14, 2005, 03:00:37 AM
You want one channel recording and one channel playback ? Instead of stereo playback/recording ?
Title: Re: New recording idea, a bit crazy
Post by: lenny on December 14, 2005, 10:18:14 AM
I think it's a great idea. I even think it would be possible to get music editing software in there too. :)
I'm glad you like the idea too. what do you mean by music editing software exactly? what are you thinking?

You want one channel recording and one channel playback ? Instead of stereo playback/recording ?
um, no. I want a multitrack recorder. record a new track while simultaneously playing back multiple previously recorded new ones. Think of it as a very small mobile recording studio for musicians.

Anyway....
One more thing, humor me please. If I were to say that I wanted to learn how to program just so I could write this thing I'm dreaming up, what would I need to learn and how long would it take me to do learn so I could write this assuming I've got a good head on my shoulders? (the most complex I ever got language wise was php)
That's the thing I'm most curious about right now. Anybody have an answer to that?

-Lenny
Title: Re: New recording idea, a bit crazy
Post by: XavierGr on December 14, 2005, 11:01:37 AM
From what I understood he means:
1) Record something.
2) Play it back and record what you will play plus the playbacked file.

This way you will be able to add new "channels" to the recorded file.
(E.g You play guitar, then you want to add a second guitar, or vocals)

Seems interesting idea though I don't know if such thing si possible.
Title: Re: New recording idea, a bit crazy
Post by: lenny on December 14, 2005, 11:28:42 AM
You got it right XavierGr.
Title: Re: New recording idea, a bit crazy
Post by: pabouk on December 14, 2005, 11:38:37 AM
2) Play it back and record what you will play plus the playbacked file.
Rather than playing a single file it would be better to mix and play several files (tracks) simultaneously. Instead of recording mix of the playback and signal from the microphone it would be better to record just sound from the microphone. I think it is possible. I guess that H100 series is capable of simultaneous playback of 4-5 mono tracks and recording of one track (44.1 kHz 16 bits uncompressed).
Title: Re: New recording idea, a bit crazy
Post by: OtisFunkmeyer on December 14, 2005, 12:03:48 PM
I think it's a great idea. I even think it would be possible to get music editing software in there too. :)
I'm glad you like the idea too. what do you mean by music editing software exactly? what are you thinking?

-Lenny

Like Cooledit or Acid.

It would enable you to view and edit the wavform (or mp3form).   Cut it into separate tracks, adjust the amplification (permanently), loop a selection, add effects, cut out unwanted sections, adjust pitch and/or speed, basically edit the file in many ways.

an ID# tag editor would be awesome too.
Title: Re: New recording idea, a bit crazy
Post by: fizze on December 14, 2005, 03:29:45 PM
yeah, i think thats possible too.
would be fun for rehearsing ;)

it would deffo be delayed though, like 50-100ms, but as its not have to be hard-realtime, that shouldnt really matter.

the limiting factor here is memory bandwidth, as those streams deffo have to be uncompressed.....
Title: Re: New recording idea, a bit crazy
Post by: MoAv on December 14, 2005, 05:11:24 PM
OK, sorry ... thought you ment because of CPU usage you wanted it to play only one channel and record another, so no, you can't do that on a 120mhz chip . mixing two tracks into one , or playing and recording at the same time , is just like playing two different songs , that this CPU can't handle . Though I wish it was a PDA too .
Title: Re: New recording idea, a bit crazy
Post by: lenny on December 14, 2005, 09:43:40 PM
yeah. it would record all the tracks to seperate wav files. I'm not suggesting that new tracks get mixed in with the old, or that it re-records the old tracks over again, that's not really how a multi-tracker is supposed to work. (And I'm not upset at all if all of you didn't understand what I was saying, I'm know the way I said it was very unclear/incomplete.)

I'm hearing from you guys for the most part that cpu wise it's possible, after all, how hard is it to play/write uncompressed wav?

I think there is a plugin already that can split mp3 tracks (and wav?), but it hasn't been ported to the iriver yet. As far as the other stuff OtisFunkmeyer, that sounds cool too.

fizze- I suppose there would be a delay, but is it possible that it would be the same everytime and therefore automatically adjusted? also, could you explain what you mean by that memory bandwidth stuff, do you mean loading multiple wav files for simultaneous playback would fill up the memory quickly, meaning more disk access. I do suppose this is something one would want to do with the charger.

And MoAv, when I was reading your post I remembered something funny. Awhile back I encoutered a bug that let me play an mp3, go into the recording screen and while it was still playing start recording, and it recorded the song! So I'm pretty sure (while having no technical knowledge) that cpu wise, it can handle this idea. I'd be curious as to find out how many tracks it can handle. Even two would be worthwile to me, but I would hope for more. I suppose one would have to write the plugin to find out for sure which reminds me...
If I were to say that I wanted to learn how to program just so I could write this thing I'm dreaming up, what would I need to learn and how long would it take me to do learn so I could write this assuming I've got a good head on my shoulders? (the most complex I ever got language wise was php)
Title: Re: New recording idea, a bit crazy
Post by: fizze on December 15, 2005, 03:30:32 AM
No, I mean that you have to interleave (mix down) multiple WAVE audiostreams to a single one. and this means a lot of memory activity.

think of an 8-track:
44.1kHz, 16bit, mono sources means 88200bytes / sec., times 8 means 705600bytes / sec.
you have to downmix these to 1 stream (which takes some cpu) (essentially shifting them 3 bits to the right and adding together).

so, you have the 8 sources somewhere in memory (in different locations), so caching will miss (if the unit has (half-decent) caching *shrugs*)

so thats RANDOM memory bandwidth, combined with a lot of cpu.
sequential memory access is a LOT faster, cos CAS / RAS delays may be bypassed, and let alone caches. almost true random access is slow. so thats why its the limiting factor.

still, one could work at 22050kHz @ 16bit which would half the b/w amongst other tweaks.
Title: Re: New recording idea, a bit crazy
Post by: pabouk on December 15, 2005, 04:14:02 AM
lenny - Yes, the delay will be constant and it can be (easily) eliminated.

fizze - The (possible) problem with intensive memory access to many different locations can be solved by interleaving the audio buffer. Example of 16 bit words storage for 3 channels playing and one recording (channel number 4):
Representation: [5s20] is the 20th sample of the channel number 5.
Code: [Select]
[1s01][2s01][3s01][4s01][1s02][2s02][3s02][4s02][1s03][2s03][3s03][4s03]...
Interleaved disc storage would be useful too but I do not know if it is possible with the standard wav format.

Edit after a little bit of thinking: The interleaved memory buffer without the interleaved file format (i.e. single file for all the channels) would be difficult or impossible with DMA transfers between the disc and the memory...

The limit of number of simultanously playing channels can be overcome by preparing the mixed track before playing it (i.e. not mixing it in real time) while still retaining the unmixed channels but I think hardly anyone would like to use more than 5 channels.

Another idea: It would be almost perfect tool if one could prepare a "mixing profile" i. e. another (meta) track with stored volume changes, position in stereo, filters etc. of the channels to mix.
Title: Re: New recording idea, a bit crazy
Post by: fizze on December 15, 2005, 05:18:00 AM
erm ? 5 is a wicked number. leave it to powers of two, as the mixing is a SHR, and ADD, then.

4, or 8 should suffice.
and anyway, about 32megs of memory (for the H300's at least) could fit 8x20sec of 44.1kHz, 16bit audio plus a final out buffer.

so one would have to align the individual track buffers with the RAS/CAS for ideal thruput and downmix it, maybe once, doesnt have to be in realtime (although it would be neat)

so essentially it wouldnt be multi-tasked in terms of playback. the only still remaining problem is full duplex. playing back the final-buffer and recording to one of the 8 track buffers. when recording is complete, the final buffer is updated, and there you go.

while this would essentially work, it lacks the nice features of an 8track (insert your favorite sampler here):
no real-time track mute/unmute
no real-time track volume adjustments
and, no real-time filters whatever (yeah yeah ;))

but Id say, once the basic concept (above) works, one would see how/if the hardware does suffice. right ?


@ your other idea ? mixing profile ?
please explain, I dont get it.
filters ? are you insane ? ;) the coldfire isnt a DSP *g*
Title: Re: New recording idea, a bit crazy
Post by: pabouk on December 15, 2005, 06:17:22 AM
Mixing profile - maybe it is not the best name for it..
It would contain information for mixing the channels together:
- volume envelopes
- stereo panning envelopes
- filters settings / envelopes - yes, it is too much for real time

The aim is to prepare the mix (with possible channel attenuating and muting) before recording the next channel because you will not have much time to set the channel volumes or mute the playing channels during recording.

It can be also used for mixing (mastering) the channels together (not completely in real time) directly on the DPA. The problem is that you do not have enough controls (buttons) on the DPA to mix multiple channels together in real time as on a real mixing panel with many potentiometers, buttons etc.
Title: Re: New recording idea, a bit crazy
Post by: b0br on December 15, 2005, 10:12:11 AM
Very well!
I need such feature so much for composing music for percussions and saxophones (it's one of major reasons why i get h340 on monday). I'm glad you suggested this - i had the same idea in head for 3 weeks :))

Is there any difference in technical things discussed between h100 and h300 series? Would it work on both in the same way (i mean when somebody writes the code fo h100, would it - after some changes - work on h300?
Title: Re: New recording idea, a bit crazy
Post by: pabouk on December 15, 2005, 12:08:07 PM
H300 series is very similar to H100. I think it would work there with minimal modifications.
Title: Re: New recording idea, a bit crazy
Post by: Paul Slocum on December 16, 2005, 01:22:31 AM
Really cool idea.  Based on my experience with audio recording on older computers, I'd guess that several simulataneous tracks/samples could be played back at once.

Considering the limited display of the iRiver (and most DAPs) a tracker-style interface would probably make more sense.  Although originally designed for synth chips, they can work for audio.  A non-graphic interface takes a little getting used to, but it's intuitive once you get the hang of it.  And it's much easier to code.

http://en.wikipedia.org/wiki/Tracker

http://en.wikipedia.org/wiki/Module_file

-paul
Title: Re: New recording idea, a bit crazy
Post by: fizze on December 16, 2005, 03:15:26 AM
H100 and H300 are exactly the same as far as cpu horsepower and such is concerned.
the only difference is that  the H300s have 32MB of RAM, while the H100s have 16MB, iirc.

Yes, this would make a VERY worthwile addition, especially when I think of potential optical digital inputs on the H100s.... :)
Title: Re: New recording idea, a bit crazy
Post by: pabouk on December 16, 2005, 04:11:19 AM
H100s have 16 or 32 MB RAM: H110 and H115 - 16MB;  H120 and H140 - 32 MB
Title: Re: New recording idea, a bit crazy
Post by: bigtrouble77 on December 16, 2005, 10:03:47 AM
Sorry, I only skimmed through the previous posts so I may be suggesting the same thing, but this is the only way I can see multitrack recording working....

- Creates a session file organizing all the recorded tracks with meta data for each track to set things like volume level, pan, etc. (simple xml file?)

- At recording time only a session mixdown is played back- I can't imagine that rockbox can do a realtime mixdown.

- Two mixdown process types, Session and Final.  Session process is purely for recording and Final is for listening to the final result. (you may only want to record to drums and bass, or you may want to record with all tracks played back so there needs to be the ability to set the tracks to record along with)

If rockbox can play and record simultaneouly this could be an amazing tool. 
Title: Re: New recording idea, a bit crazy
Post by: lenny on December 20, 2005, 01:22:48 AM
Well, I saw this in the mailing lists...

Quote from: Linus Nielsen Feltzing
David Pedersen wrote:
> If there is any such tone, it is close to useless. It can't be heard,
> unless you mean that low frequent buzz that is in the left channel, when
> you start a recording. But that is so low, that almost whatever you do
> record, the input sound would far outrange this buzz. What we really
> ned, is a BEEP, that would be in the range of 500-1000hz, and I guess,
> approximately 0.3-0.5 second duration. And maybe even adjustable in volume.

Yes, we know it hardly audible, but it's the best we can do. The
hardware won't let us play audio and record at the same time.


Linus

He was addressing a different question, but it does seem pertinent. Please say this doesn't mean what I think it does! Is this true? Are you reading this by any chance Linus?
Title: Re: New recording idea, a bit crazy
Post by: fizze on December 20, 2005, 02:27:39 AM
is he talking about the iRiver H100/300s ?

I also havent taken a look at the specs, but the fact that I actually can enable monitoring in the iRiver firmware gives a hint. maybe its only true for a single buffer, but tbh I doubt it. gonna take a look at that.
Title: Re: New recording idea, a bit crazy
Post by: lenny on December 20, 2005, 02:39:01 AM
honestly I don't know fizzie, the model name wasn't mentioned
Thanks for checking on it though!

and while you do that... dare I ask again?
One more thing, humor me please. If I were to say that I wanted to learn how to program just so I could write this thing I'm dreaming up, what would I need to learn and how long would it take me to do learn so I could write this assuming I've got a good head on my shoulders? (the most complex I ever got language wise was php)
I've figured out that I should probably learn C, but does that mean I just go to the store and get a "learn to program in C" book? Would this be overkill? Would it be insufficent? Should I just give up the question already?
Title: Re: New recording idea, a bit crazy
Post by: fizze on December 20, 2005, 04:20:59 AM
well, you'd have to mess with hardware internas. C is fun, yeah. but its quite different from PHP ;)

take a look at classical "hello world" stuff online, no need to buy a book (yet).
theres plenty of online tutorials which are very good.


edit:
I just read the datasheet on the UDA1380, and there is no word of it not being full duplex capable.

the unit is capable of "mixing" input with a digital output without an external DSP though. but this is mostly restricted to amplification.

in other news, the "detection" that was mentioned is restricted to clipping on the headphone out, as well as "short circuiting" the unit.
Title: Re: New recording idea, a bit crazy
Post by: BenJenkins on March 06, 2006, 04:37:39 PM
I have to say that this is a great idea. 4 tracks should be plenty. I'd even be happy with just two tracks. (Now, if I could only find a 140 for sale.)
Title: Re: New recording idea, a bit crazy
Post by: bennis on March 08, 2006, 04:45:03 PM
great ideas guys! please work them out! I could surely use a 4 track recorder in my pocket :)
Example: Record a tune in the studio, mix it down to a stereo guide track on your iriver, then go to a nice place with a great sounding grand piano / percussion / horns section / hammond -- plugin a GOOD stereo mic --> give the musician a headphone and record the the intrument in sync with the guidetrack!

After recording go home, upload the new stereo track to your multitrack software ( nuendo, cubase, sonar, protools etc) --> mixdown and be happy!

Would be sooo cool, quick and concenient
Title: Re: New recording idea, a bit crazy
Post by: LinusN on March 08, 2006, 04:53:28 PM
My statement above applied to the Archos hardware alone.
Title: Re: New recording idea, a bit crazy
Post by: lenny on March 08, 2006, 07:13:22 PM
whew! that's a relief Linus. I've been waiting since december 20th for that answer (j/k ;))

come summer if someone hasn't taken this idea and run with it, I think I'll invest some time and learn C. Maybe. but it would be cool if somebody that knew how did it!

edit: thanks bennis for reviving this thread, maybe something good will come of it
Title: Re: New recording idea, a bit crazy
Post by: pupil on March 09, 2006, 05:49:09 PM
sweet lord, PLEASE make this happen, this would be the greatest thing ever, as being able to record extra instruments outside out the studio (ie grand piano as someone stated earler) with this would be amazing!

I'm sure you've all seen this puppy:

http://www.m-audio.com/products/en_us/MicroTrack2496-main.html

technically (software wise at least, maybe not quite up to the quality hardware wise) a 4track iRiver would be better than the M-Audio 2 track recorder!

please make this happen, you would make me sooooo happy!
Title: Re: New recording idea, a bit crazy
Post by: nslhrn on March 13, 2006, 06:49:40 AM
I think this would be agreat options also.
I envision being able to use the Samson USB mic  or the Snownall from Blue.
And then also to have the option to use some sort of direct box to the line-in.

Or how about having it some that I can record two mono sources simultaneously so that I can sing lead a partner plays  bass. Then I can go back and add back ground vocals. 2 or three.

Im sure this could be accomplished with some sort of mixer before outputing to the iRiver, I'm just imagine plugging a usb mic into the iRiver and another mic into the input Or have the software read the stereo mic as to differnet tracks. So that if iRiver can play 4 tracks two would be used in a single pass but kept as different 'takes'

This would make a nice pocket composer's studio for capturing ideas and creating all the harmony to support the idea. I find I often sing some things but when I listen back, I can't rememeber the additional parts I was thinking of. Multi-track would allow me to capture the other parts I hear and preserve my ideas.

Cool idea. Hope it works out.
Title: Re: New recording idea, a bit crazy
Post by: gitarald on April 29, 2006, 04:56:27 AM
This is just to let you all know that there's another one out there dreaming of this possibility to use his iriver as a mobile multitracker studio ... 

;) Harry
Title: Re: New recording idea, a bit crazy
Post by: 969696 on May 27, 2006, 03:26:42 AM
Hi ! I bought a h120 to record my flute playing. Being able to record over a drum or a bass track would be great.

Another dreamer.
Title: Re: New recording idea, a bit crazy
Post by: zenx on August 17, 2006, 07:38:30 PM
is this possible at all? opinions?
Title: Re: New recording idea, a bit crazy
Post by: NK-A on September 14, 2006, 02:30:19 PM
As you can read on this forum some people think it could actually be possible. However noone smart enough (and motivated enough and so on...) have had the time to do something about this. Or so it seems anyway. I guess it takes a lot of work and is not the highest priority. So we normal dummies that don't know how to do it just have to wait and see if something happens. I would love to see this feature in rockbox, but that just isn't enogh to make things happen...
Title: Re: New recording idea, a bit crazy
Post by: petur on September 14, 2006, 06:21:51 PM
full duplex sound is not the problem as in one of my experiments I have managed to record the voice output ;) (this was before the encoder framework and before running recording unboosted however)

The problem lies more in the fact that, the way rockbox works now, you're either playing or recording as the buffer is shared.
Title: Re: New recording idea, a bit crazy
Post by: cpartiot on November 18, 2006, 04:32:02 PM
good idea ! ;) is somebody able to do that ?
very interesting for band recording !!!
Title: Re: New recording idea, a bit crazy
Post by: jhMikeS on December 05, 2006, 12:00:46 AM
Just write the plugin. The apis are present in the plugin api. Mixing channels is not CPU intensive at all (voice is mixed live with playback). preglow and I have already implemented effects with low latency (flanger with feedback and ring mod respectively) and some other revisions I discussed in IRC with amiconn can lower the latency to near 0. Those changes should be very straigtforward and the core recording will use them too.
Title: Re: New recording idea, a bit crazy
Post by: mlind on December 05, 2006, 05:27:58 PM
...preglow and I have already implemented effects with low latency (flanger with feedback and ring mod respectively)...

You didn't also happen to put some of these ideas into code:
http://forums.rockbox.org/index.php?topic=2307.0
?? ;)
Title: Re: New recording idea, a bit crazy
Post by: Multiplex on December 06, 2006, 08:47:11 AM
... preglow and I have already implemented effects with low latency (flanger with feedback and ring mod respectively)
Are your effects, or a skeleton, available as source to act as seeds for neebs like me who find the idea of starting from scratch too daunting ?

(I've tried playing a bit with pitch changing on a PC but I only have Delphi as an IDE and all the interesting algorithms I've found are C or C++)

Edit: some sober thought made me realise that all the Rockbox DSP stuff is Fixed point and the PC algorithms make use of Floating Point and even Trig functions ... it will be a lot more work than I imagined ... still worth playing with ;-)
Title: Re: New recording idea, a bit crazy
Post by: halmi on November 06, 2007, 03:14:17 PM
Hello ROCKbox-Community,
please excuse my probably bad english. I'm an Austrian student and I'll do my best.

I know that the last post in this thread is nearly a year old, but there have been some other posts (eg. here (http://forums.rockbox.org/index.php?topic=11734.0)) about that topic and I want to ask if some kind of development is going on in this direction.

For me it would be enough if I could listen to one file while recording to another one.

Then it would be cool to have a plugin which can mix multiple tracks and export that as a new audio file. Of course this needn't be in realtime. So you can mix that tracks together that you want to hear via headphones while you are recording. If that mixer has some more options it would also be suitable to create a final mix, but maybe that goes a bit too far...

If it is possible to code just the listening-while-recording thing, that would be a great step.

As far as understand there is also a Feature Request in the tracker, which requests the same thing, but it did'n get much attention till now.
http://www.rockbox.org/tracker/task/6723
Title: Re: New recording idea, a bit crazy
Post by: jhMikeS on November 07, 2007, 07:32:54 AM
What do you expect out of these devices? They really aren't engineered for this sort of use. I'm against introducing any such functionality in the core but anything the core recording uses (the very same API in fact) is available to a plugin intended to do exotic things.

Some have said they can't get recording to function in a plugin so I simply recommend they imitate pcm_record.c to the letter - no shortcuts because they assume some function call isn't nescessary - they all are. Use the API as intended and it will work. It is verified to work.

EDIT - I'll mention here too that full-duplex sound on ColdFire based devices is also verified to work. I've handed out the effects plugins (simple proofs of concept) source codes to those who have asked on several occasions.