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

Thread: Change AUDIO_BLOCK_SAMPLES from the ino file

  1. #1
    Junior Member
    Join Date
    Sep 2019
    New York

    Change AUDIO_BLOCK_SAMPLES from the ino file

    I know this topic was covered in the past and saw the thread from chipaudette years ago. Today I see the Audiostream.h file has a #ifndef AUDIO_BLOCK_SAMPLES... but when I try to pre define this in the ino file, all hell breaks loose. I mean it has an effect but not the same than when defined directly in the Audiostream.h file.
    I am trying to minimize my latency in a synth sine wave from a DAC in Teensy 3.6, so can be synchronized with an external pulse. When reducing from 128 to 16 samples (minimum possible) latency goes from over 10mS to under 3mS and things work nice and smooth, but trying to define in the ino file has different effects, depending the block size can be from emitting a random noise, to just crash the program.
    I want to make the program easily portable for students to use in their own simple IDE setups, where they may need the default 128 samples (needed for most other audio applications) and know little about deep buried libraries. No idea why this is happening, I try to find other defines everywhere that may be at conflict, but only see other under the Teensy 4 tree. Does anybody is aware of any easy way to define this from the ino or some other sketch folder file?

    Thank you,

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    You can't change core library defines from the .ino file.

  3. #3
    Senior Member manicksan's Avatar
    Join Date
    Jun 2020
    as he say
    this is in the AudioStream.h

    #define AUDIO_BLOCK_SAMPLES  128
    would it not then be possible to do a custom define in the .ino file
    just before all #include:s ?

    or do the compiler compile all core files first without any includes in the .ino file?

  4. #4
    Senior Member
    Join Date
    Apr 2014
    There are a couple of ways. The compiler just needs to know the defines before it compiles the project. You can do it with Lunis system has a way to do it. Defragster has a TSET that can do it. Or with something like this

Tags for this Thread

Posting Permissions

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