Quantcast
Channel: Digital I/O topics
Viewing all articles
Browse latest Browse all 2177

Simple way to control speakers via analog output

$
0
0

Hello to all,

My institution has several NI tools for my thesis.

 

We have a chassit 1033 and two NI 44-98 cards allowing the recording of vibration in a sample via accelerometers.

 

We have recently acquired a NI 6323 card and two SCB 68A.

 

The AO ports of the two SCB68A are connected to amplifiers connected to speakers.

 

I would like to find a simple way via python to emit the desired signals, to transmit them to the amplifier which itself will transmit them to the speakers. This allows me to have a total control of my source.

 

For the moment, I can't find any example in python similar to what I would like to do.

I started to code a piece of code, but it doesn't work.


import nidaqmx
rate = 40000 # Sample rate in Hz
duration = 10 # Duration in seconds

samples = int(rate * duration)
list = []
for x in range(samples):
list.append(x % 2)
with nidaqmx.Task() as task:
task.ao_channels.add_ao_voltage_chan("Dev1/ao1")
task.timing.cfg_samp_clk_timing(rate)
task.write(list, auto_start=False)
task.start()

 


Do you have any examples that I could use as inspiration, or any ideas?

Sincerely,

 

Thomas


Viewing all articles
Browse latest Browse all 2177

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>