Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 7 of 7

Thread: Fastest way to get the content of the two queues transferred to the PC

  1. #1

    Fastest way to get the content of the two queues transferred to the PC

    Hi,

    sorry for the strange question, but what is the fastest way to get the content of the two queues transferred to the PC?
    Let's say the queues each contain only one sample block of audio data as an example.
    Should I serial transfer the data one after the other or is there a better way?
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	2021-03-19_164612.png 
Views:	11 
Size:	15.7 KB 
ID:	24112  

  2. #2
    Senior Member
    Join Date
    Aug 2016
    Location
    Australia
    Posts
    183
    Use the USB Output object and set the Serial device type in Arduino to Serial + Audio + MIDI

    You should find plenty of references to USB audio in the forum and in the Teensy Audio System Design Tool notes https://www.pjrc.com/teensy/gui/inde...AudioOutputUSB

    Have fun!

  3. #3
    Thank you, but I don't quite understand it.
    I need the RAW data in 16 bit format, just like the queues provide it - is it possible this way?
    How should the evaluation on the PC side look in this case?

  4. #4
    Senior Member
    Join Date
    Aug 2016
    Location
    Australia
    Posts
    183
    OK, I thought that you just wanted audio to be available on the PC.

    I guess you'll just have to create an output object that writes to "Serial". It's not particularly difficult - just clone another Output object (C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Audio) and modify it so that it writes the blocks to Serial. output_pwm.cpp is a fairly straightforward one to use. Just delete the DMA code, as that part is already handled for Serial.

    You could create a Control object also to manage the USB link, or simply use Serial.begin() in the normal way.

    If you want to process RAW data on the PC, then you'll need to write some native code. Python is a natural choice for this: https://forum.pjrc.com/threads/66565...sb+serial+data

    Others might like to chip in at this point, as I'm just using general knowledge rather than having done this particular trick before.

  5. #5
    Senior Member
    Join Date
    Jul 2014
    Posts
    3,152
    Quote Originally Posted by DIYLAB View Post
    Thank you, but I don't quite understand it.
    I need the RAW data in 16 bit format, just like the queues provide it - is it possible this way?
    How should the evaluation on the PC side look in this case?
    the reply #2 still holds.
    the best way to transfer two queues to the is to use USB-Output and connect it to the two queues. This will take the data and transfer to PC.
    what you do with data on PC is your business.
    You have to write a program that takes in Audio data and provides you access to the data stream.
    All this depends on your OS, the tools at your hand and capabilities to program a PC.

  6. #6
    Quote Originally Posted by palmerr View Post
    I guess you'll just have to create an output object that writes to "Serial".
    Hi,
    I already write the audio blocks serial via USB.
    Therefore I asked if it is so correct or if there are other ways.
    I had read something about RAW Hid ( https://www.pjrc.com/teensy/rawhid.html ), but that seems to be not the right thing.

  7. #7
    Senior Member
    Join Date
    Jul 2014
    Posts
    3,152
    Quote Originally Posted by DIYLAB View Post
    Hi,
    I already write the audio blocks serial via USB.
    Therefore I asked if it is so correct or if there are other ways.
    I had read something about RAW Hid ( https://www.pjrc.com/teensy/rawhid.html ), but that seems to be not the right thing.
    IMHO, using the audio datapath is better than RawHID, if you can live with the predefined sampling rate.
    IIRC, with RawHID you have up to 64 byte/ms.
    Obviously, with some low-level programming data rates can be changed.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •