Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tutorial: listening to ephys singals #116

Open
jonnew opened this issue Oct 25, 2024 · 4 comments
Open

Tutorial: listening to ephys singals #116

jonnew opened this issue Oct 25, 2024 · 4 comments
Assignees
Labels
user-friendliness Missing tutorials and user guide
Milestone

Comments

@jonnew
Copy link
Member

jonnew commented Oct 25, 2024

A tutorial for listing to ephys signals through the audio device on the computer. This issue was inspired by the this conversation:

image
@jonnew
Copy link
Member Author

jonnew commented Oct 25, 2024

Here is a starting point with buffer settings set to match typical buffer lengths from the ephys data nodes (30 samples):

Audio starting point
<?xml version="1.0" encoding="utf-8"?>
<WorkflowBuilder Version="2.8.5"
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 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="dsp:FunctionGenerator">
          <dsp:BufferLength>30</dsp:BufferLength>
          <dsp:Frequency>1000</dsp:Frequency>
          <dsp:Waveform>Sine</dsp:Waveform>
          <dsp:SampleRate>30000</dsp:SampleRate>
          <dsp:Amplitude>1000</dsp:Amplitude>
          <dsp:Offset>0</dsp:Offset>
          <dsp:Phase>0</dsp:Phase>
        </Combinator>
      </Expression>
      <Expression xsi:type="Combinator">
        <Combinator xsi:type="al:AudioPlayback">
          <al:DeviceName>Generic Software on Speakers (Realtek(R) Audio)</al:DeviceName>
          <al:SampleRate>30000</al:SampleRate>
          <al:State>Playing</al:State>
        </Combinator>
      </Expression>
    </Nodes>
    <Edges>
      <Edge From="0" To="1" Label="Source1" />
    </Edges>
  </Workflow>
</WorkflowBuilder>

@cjsha
Copy link
Member

cjsha commented Oct 28, 2024

What headstage would be best for this tutorial? I'm thinking we do it for np2 and then explain that it can be generic for other headstages. Here's an untested example using np2:

listen-ephys.bonsai.zip (attached zip file bc github doesn't accept bonsai files)

image

@jonnew
Copy link
Member Author

jonnew commented Oct 28, 2024

Yep I think that's a good one.

@jonnew
Copy link
Member Author

jonnew commented Oct 28, 2024

On the ConvertScale node, expose the gain property and and indicate that its a volume control. Also, do we need to level shift the offset binary data produced by the the Neuropixels Data node into twos complement to play nicely with audio device?

If we can convert into some type (e.g. float) that it is easier to understand in terms of volume (e.g. -1 to 1 is max) or something, then lets do that.

@ChucklesOnGitHub ChucklesOnGitHub added this to the Priority 2 milestone Oct 28, 2024
@ChucklesOnGitHub ChucklesOnGitHub added the user-friendliness Missing tutorials and user guide label Oct 28, 2024
@ChucklesOnGitHub ChucklesOnGitHub removed this from the Priority 2 milestone Oct 28, 2024
@cjsha cjsha added this to the Two milestone Oct 29, 2024
@cjsha cjsha modified the milestones: Three, Two Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
user-friendliness Missing tutorials and user guide
Projects
None yet
Development

No branches or pull requests

3 participants