Replies: 3 comments 8 replies
-
|
The easiest would be to use the FunctionGenerator operator. Set the buffer size to match the resolution of the frequency update you need, and progressively increase the frequency by externalizing the property. If you need something more bespoke I would probably just generate the full waveform in Python and load it in bonsai using MatrixReader. |
Beta Was this translation helpful? Give feedback.
-
|
I have a very similar question and would like to generate an auditory sweep as well. I've tried FunctionGenerator but none of the things I tried to modulate the frequency property worked. Could you please provide some more input on how you'd change e.g. from 10-80 kHz over a specific time frame? I tried Timer and Sample as well as several other things but couldn't get it to sweep. thank you! |
Beta Was this translation helpful? Give feedback.
-
|
This is a naive implementation but shows you how to sweep from 1-15khz in roughly 10 seconds. I am working with buffer sizes, but you should be able to define everything in time with some math. <?xml version="1.0" encoding="utf-8"?>
<WorkflowBuilder Version="2.8.5"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:rx="clr-namespace:Bonsai.Reactive;assembly=Bonsai.Core"
xmlns:dsp="clr-namespace:Bonsai.Dsp;assembly=Bonsai.Dsp"
xmlns:al="clr-namespace:Bonsai.Audio;assembly=Bonsai.Audio"
xmlns="https://bonsai-rx.org/2018/workflow">
<Workflow>
<Nodes>
<Expression xsi:type="Combinator">
<Combinator xsi:type="rx:Timer">
<rx:DueTime>PT0S</rx:DueTime>
<rx:Period>PT0.01S</rx:Period>
</Combinator>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="rx:Take">
<rx:Count>1000</rx:Count>
</Combinator>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="dsp:Rescale">
<dsp:Min>0</dsp:Min>
<dsp:Max>1000</dsp:Max>
<dsp:RangeMin>100</dsp:RangeMin>
<dsp:RangeMax>15000</dsp:RangeMax>
<dsp:RescaleType>Linear</dsp:RescaleType>
</Combinator>
</Expression>
<Expression xsi:type="PropertyMapping">
<PropertyMappings>
<Property Name="Frequency" />
</PropertyMappings>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="dsp:FunctionGenerator">
<dsp:BufferLength>441</dsp:BufferLength>
<dsp:Frequency>14985.1</dsp:Frequency>
<dsp:Waveform>Sine</dsp:Waveform>
<dsp:SampleRate>44100</dsp:SampleRate>
<dsp:Amplitude>100</dsp:Amplitude>
<dsp:Offset>0</dsp:Offset>
<dsp:Phase>0</dsp:Phase>
</Combinator>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="al:AudioPlayback">
<al:SampleRate>44100</al:SampleRate>
<al:State>Playing</al:State>
</Combinator>
</Expression>
</Nodes>
<Edges>
<Edge From="0" To="1" Label="Source1" />
<Edge From="1" To="2" Label="Source1" />
<Edge From="2" To="3" Label="Source1" />
<Edge From="3" To="4" Label="Source1" />
<Edge From="4" To="5" Label="Source1" />
</Edges>
</Workflow>
</WorkflowBuilder> |
Beta Was this translation helpful? Give feedback.



Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I would like to generate a sweep signal 10-80 kHz and then feed it to an AnalogOutput(DAQmx). The aim is to play back the signal and make sure that two ultrasonic microphones I am using have the same frequency response. Is it possible to generate such sweep in Bonsai?
Thanks in advance
Beta Was this translation helpful? Give feedback.
All reactions