How to do USB audio
Pages: 1 ... 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 ... 52
Colin (478) 2433 posts |
As far as USB is concerned your record player looks exactly like Chris Gransden’s device. Does it have a headphone socket and do you have headphones? If so you could test playing audio with my modules. If you don’t have any 44100/16bit wav files you can get a short test one here. Only the 16bit 44.1kHz files will work. If that works then recording will probably work. I can modify the recording program to work with your player for you. It’ll be recorded to a 44100 16bit 2 channel wav file – nothing fancy just start recording, stop recording in a task window. If you want that converting to mp3 or whatever you’ll need another program to convert it after the recording. If you can’t use an earphone socket to listen to music on the record player let me know and I’ll modify the recorder anyway. |
Colin (478) 2433 posts |
I’ve modified !IsocRecorder in USBModule.zip and it should work with your record player – see the !Readme file. Any questions just ask. It should also record from the Behringer device Chris Gransden has. |
Chris Gransden (337) 1207 posts |
I end up with a file with just the WAV header in it. Also the link above is pointing to USBDescriptors.zip. |
rob andrews (112) 200 posts |
Same thing with me after editing the output file as required, when you stop recording it trims it too just the header of 44 bytes. |
Colin (478) 2433 posts |
Either of you have a web cam so we can try a different device. If so can you post the descriptors with it plugged in. I’d just like to establish that the devices you are using don’t need anything different |
rob andrews (112) 200 posts |
link to record player discriptor https://dl.dropboxusercontent.com/u/33574509/Recordplayer2.txt |
Colin (478) 2433 posts |
I have that thanks. I was wanting to try a microphone on a webcam – or anything else with a microphone on just to see if we can get something working. Just to eliminate the obvious you are running the new usb modules before trying !IsocRecorder. |
Chris Gransden (337) 1207 posts |
I get the same result using a webcam. The output of !USBDescriptors is here. |
Colin (478) 2433 posts |
Your webcam shouldn’t have worked I have to alter the program to recognise it. Did you get as far as ’Press any key to stop? I’ve modified the version in USBModule.zip to recognise your webcam. Unfortunately !IsocPlayer won’t play the mono output but you can tell if it records from the size of the output file (or play it in something else). |
Chris Gransden (337) 1207 posts |
I just added the required values to !IsocRecorder. Got them using the output of !USBDescriptors.
Still no joy. Just the header after pressing a key. |
Colin (478) 2433 posts |
Hmmm… Dave Higton. If you’ve got things working on your beagleboard you wouldn’t like to try recording would you. |
Dave Higton (1515) 3526 posts |
I will try it this evening and let you all know. |
Dave Higton (1515) 3526 posts |
First I tried IsocRecorder with one of my “3D Sound” headset adaptors on the Iyonix, and found that it quickly created a large file. Then I moved the adaptor over to the BBxM and tried it there with the identical software. Although the LED in the adaptor flashed, showing activity, the resulting file was just 44 bytes. The same result occurred, not surprisingly, whether I plugged the adaptor directly into the BBxM or into the associated hub. |
Colin (478) 2433 posts |
Was the recording on the Iyonix via a USB2 hub? |
Steve Pampling (1551) 8170 posts |
IIRC the front USB ports and the rear ports differ in the standard (USB1 vs. USB2) – of course that could just be bad memory. |
Dave Higton (1515) 3526 posts |
Originally yes, but I’ve just repeated it with an iMic (the iMic has a flying lead, the “3D Sound” one doesn’t fit into the front panel because of the recess, I can’t find my extender cable) both direct into the front panel and via a hub, and it works in both cases. Funny that there’s no mouse “sluggishness” (i.e. no pauses of ~1 second where nothing comes in via USB) on the Iyonix either. |
Dave Higton (1515) 3526 posts |
And there’s another thing – with these modules on the BBxM, the machine seems to stiff every time I shut down. |
Colin (478) 2433 posts |
All ports are both. When a USB1 device is plugged in it is handled by the OHCI Driver. When you plug in a USB2 device it is handled by the EHCIDriver. However when you plug in a usb1 device via a USB2 hub it is handled by USB2 (EHCIDriver). This is why USB1 devices work on a beagleboard, pandaboard or pi even though they don’t have a USB1 controller. Unlike an Iyonix these devices don’t have a usb sockets connected directly to the root. They have a USB2 hub on the motherboard and that is what you plug in to. If Dave plugged directly into the Iyonix he would have recorded using the OHCIDriver. If he plugged in via a USB2 hub he would have recorded using the EHCIDriver which is the one used on the beagle/panda boards and the one I’m testing. |
Colin (478) 2433 posts |
Yes unfortunately (for debugging purposes) it works perfectly on an Iyonix. The flashing audio device while recording even though it saved nothing on the BBxM seems significant it implies data is being transferred but not saved. Can you record to a RAM disc? Apart from sluggishness I understand that you can play – recording uses the same code in the EHCIDriver. |
Dave Higton (1515) 3526 posts |
The experiments I did were all to a RAM disc. |
Colin (478) 2433 posts |
Would anyone care to try USBModuleDebug.zip After running !USBModule run !USBRecorder. It will try and record a 0.5 sec recording on the ram disc and then output a lot of debug info in the taskwindow. If you could send the taskwindow output it would be appreciated – thanks. I’ve put an email address in the Readme file or you can post the output on a web site whichever is easier. |
rob andrews (112) 200 posts |
here are the results of running debug on the record player https://dl.dropboxusercontent.com/u/33574509/resultdebug.txt hope this helps |
Colin (478) 2433 posts |
Thanks Rob. The results are very similar to Chris Gransden’s |
Dave Higton (1515) 3526 posts |
I thought I should post here a set of basic examples of how to use the USBAudio module, so everybody can see that you don’t need to know anything about USB in order to use it. First thing you need to do is to get the names of the audio device(s) you have: DIM device% 256 SYS "USBAudio_EnumerateDevices", device%, 256 In the device% buffer you will have a device name, or comma-separated list of device names, such as: USB8 or: USB8,USB11 You’ll need the device name for all future interactions with the device via USBAudio. Let’s call it device$. If you want to get the manufacturer’s name and model number: DIM mfr% 256 DIM model% 256 SYS "USBAudio_GetDeviceName", device$, 1, mfr%, 256 TO,,,, R4 SYS "USBAudio_GetDeviceName", device$, 2, model%, 256 The strings are in Unicode, and the language ID is in R4. In theory you need the language code to interpret the string. In practice, the only language ID I’ve ever seen is &0409, and the strings are ASCII with every alternate byte 00, so practice is simpler than theory :-) OK, let’s assume we’re using our USB audio device to play some audio (what you have to do if you’re recording is almost identical anyway): DIM parameters% 32 parameters%!0 = 44100: REM Sample rate, Hz parameters%?4 = 16 : REM Resolution, bits parameters%?5 = 2 : REM Bytes per sample for one channel parameters%?6 = 2 : REM Stereo, 2 channels parameters%?7 = 1 : REM Format code; 1 means linear PCM parameters%?8 = 0 : REM Use current configuration parameters%!12 = 128 * 1024: REM Buffer size; buffer is allocated by the USB stack, not by you SYS "USBAudio_OpenOut", device$, parameters% TO stream% stream% contains the stream number, assuming the open worked. Also some parameters are added to the parameters% block; you’ll probably want them later. (That’s why the block was DIMmed bigger than what you put in.) Now you keep putting bytes into the stream to keep the buffer from emptying. You may want to control the volume, or mute/unmute the device: volume_bitfield% = parameters%!16 mute_bitfield% = parameters%!20 SYS "USBAudio_SetVolume", device$, parameters%, volume_bitfield%, volume_setting% SYS "USBAudio_SetMute", device$, parameters%, mute_bitfield%, mute_setting% When you’ve finished, close the stream: SYS "USBAudio_Close", stream% Nowhere do you need to know anything about USB. Comments, please! |
Colin (478) 2433 posts |
Rob. Would you like to try USBModule.zip with your record player. It should work now. The default output file is to RAM so you won’t be able to record for long if you don’t change outfile$ at the top of |
Pages: 1 ... 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 ... 52