audio,raspberry-pi,adc , Read voice from Rasberry Pi values (ADC)


Read voice from Rasberry Pi values (ADC)

Question:

Tag: audio,raspberry-pi,adc

Hello I'm using ADC to read voice (from client 1) then I send it to a server from which client 2 can read it. I tried to register values I got in an array and read it through windows media player to be sure that sound is well recorded but I found nothing.

Any help please about which type of values should be in the file and how to read it well.

Values in the file are like this :

4163 87401 39840 34224 8410 39539 84134 34412 40238 93974 7434 41739 34023 83412 41742 73903 93374 40341 24264 2400 42041 4174 22406 40939 93884 8419 37041 73933 77410 40745 44044 2385 39440 74114 13405 43940 14244 4455 41836 23993 83435 36738 63964 11397 38140 74044 12366 38041 24034 31403 38938 13954 17407 42340 23883 79398 39644 34183 99391...


Answer:

With Python you can try the following to convert the raw samples stored in text, to the wave file. Please note that you must know the sampling frequency of your signal and samples are assumed to be int16.

from __future__ import print_function
import scipy.io.wavfile as wavf
import numpy as np
from sys import argv

def txt2wav(in_f, out_f, fs):
    txtdata = np.genfromtxt(in_f, dtype='int16')
    wavf.write(out_f, int(fs), txtdata)

if __name__ == "__main__":
    if len(argv) != 4:
        print("usage: txt2wav.py input.txt out.wav samp_freq")
    elif len(argv) == 4:
        txt2wav(*argv[1:])

Related:


GPS App compile errors


c++,linux,gps,raspberry-pi,gpsd
I am working on a GPS application on the Raspberry pi. I have just installed GPSD by running sudo apt-get install gpsd gpsd-clients. I do get data from my GPS module when I run sudo gpsd /dev/ttyAMA0 -F /var/run/gpsd.sock. My issue resides when I try to make my own GPS...

Get 403 (Forbidden) for audio tag


javascript,ajax,audio,html5-audio
I am using following JavaScript code for play audio after complete ajax: $(document).ready(function () { $.ajaxSetup( { cache: false, complete: function () { $('#loading').hide(); $('#page_content').show(); //get gold price and compire timestamp var published_date = $("#goldprice").data("published"); var currend_date = Math.floor(Date.now() / 1000); var compare_date = currend_date-published_date; if( compare_date <= 10){ document.getElementById('ding').play();...

“Converting” in jQuery an audio player with multiple tracks


javascript,jquery,audio
I have a tracklist and I'd like to serve a preview of 3 songs with just a play and pause button. Here's the messy snippet I have right now in JS: var playing = false; playpause01.addEventListener('click', function () { if (!playing) { document.getElementById('player01').play(); this.src = 'files/img/pause.png'; } else { document.getElementById('player01').pause();...

Use same Python variable in multiple if-statements


python,if-statement,raspberry-pi,global-variables,bottle
I am having issues with my current Python script. The purpose of the 'progress' variable is take a specific value when it goes through one of the if-loops. But, the program never goes further then the first if-statement. It looks as if every if-statement makes his own variable called 'progress'....

RawSourceWaveStream volume control and playback time estimation with Naudio


audio,volume,naudio
I'm using Naudio to play audio samples from memory. private RawSourceWaveStream waveStream; private MemoryStream ms; private int sampleRate = 48000; private IWavePlayer wavePlayer; //generate sine wave signal short[] buffer = new short[(int)Math.Round(sampleRate * 10.00)]; double amplitude = 0.25 * short.MaxValue; double frequency = 1000; for (int n = 0; n...

Searching an arrayList generated by an audio recognition


java,android,audio,arraylist
I am working on app that take the audio of the user and save them in an arrayList, then searching this array list to see if the desired word generated by the google audio API exists, so we can do actions. The action that I wanted is removed and replace...

Jumbled out put of RFID Tags


python,raspberry-pi,raspbian
I am working on a project, in which I have to interface multiple RFID Readers (I'm Using EM 18, With Serial out) with Raspberry Pi. I'm using an USB to TTL Converter to connect EM 18 to Raspberry Pi. I've connected two RFID Readers using USB to TTL Adapter. This...

Unity3D Play sound from particle


audio,unity3d,collision,particles
I am trying to play a sound when a particle collides with a wall. Right now, it just plays the sound from the parent object, which is the player. However, I want the sound to play from the particle. Which means when a particle is far to the left, you...

Playing a .wav file in c# using SoundPlayer


c#,audio,soundplayer
I am currently having a probelm, where a file was sent to me as .m4a and I renamed it to .wav..... (I think that is the issue as I can play other .wav files) Now it is giving me this error when I run the code: Additional information: The file...

Raspbian log files


raspberry-pi,raspbian
Where can I find all boot, driver or kernel related logs on a Raspbian? Could you please reply with a list as follows: Driver logs - /something/somethingelse.log Thanks!...

Android How To Find Decibels


android,audio,microphone,decibel
I'm trying to get the decibels from the microphone and have looked everywhere how to correctly do it but they don't seem to work. I get the amplitude like this public class SoundMeter { static final private double EMA_FILTER = 0.6; private MediaRecorder mRecorder = null; private double mEMA =...

Python Flask persistent object between requests


python,rest,flask,raspberry-pi
I am creating a web interface for OMXPlayer on the Raspberry Pi. I'm trying to create a more REST like API for controlling the video while its playing. The issue I'm having is how to control the video while it is playing. Currently I can create a Player object which...

Playing audio for given amount of time in Android


java,android,audio,media-player
I am new to Android development. In this application, I wanted an audio to play for certain duration (say 20 seconds). After 20sec it should not start to play. I used getDuration() method, but i didn't get what i need to. Code: protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); setVolumeControlStream(AudioManager.STREAM_MUSIC);...

Use toggle button to control sound


android,audio,togglebutton
I need my app to play all the sounds when toggle button is checked and stop playing them when it is unchecked.By all sounds I mean the sound played when other buttons present in the activity and other activities are pressed. Following is my toggle button: <ToggleButton android:layout_width="70dp" android:layout_height="70dp" android:id="@+id/toggleButton"...

How can I get my iPhone to listen for sound frequencies above a certain threshold?


ios,objective-c,iphone,audio
I'm interested in getting my iOS app to turn on the microphone and only listen for frequencies above 17000 hz. If it hears something in that range, I'd like the app to call a method. I was able to find a repository that detects frequency: https://github.com/krafter/DetectingAudioFrequency And here is a...

Access GPIO (/sys/class/gpio) as non-root


bash,raspberry-pi,chmod,chown,raspberry-pi2
The /sys/class/gpio can only be access as root by default. So I like that a new group gpio can use the files and dirs under /sys/class/gpio. To achieve that I added the following lines to /etc/rc.local (I'm on Debian): sudo chown root:gpio /sys/class/gpio/unexport /sys/class/gpio/export sudo chmod 220 /sys/class/gpio/unexport /sys/class/gpio/export So...

Raspberry Pi script boot order


raspberry-pi,crontab,raspbian,init.d,ppp
There're three forms about running a script on the boot of the Raspberry, that are modifying /etc/rc.local, modifying the cron daemon and making a script that automatically run on boot in /etc/init.d I want to know which of the methods listed about executed first. The point of the question is...

Raspberry Pi MicroSD Boot not working, MicroSD card unreadable on PC


raspberry-pi
I downloaded the necessary files for Raspberry Pi onto a MicroSD card, although the MicroSD card is no longer readable. When I put the card into the computer through a MicroSD to USB adapter nothing shows up in Windows Explorer. The card isn't present in Windows Disk Management either. How...

Audio through built-in speakers when earphones are plugged in headphone jack in Android


android,audio,soundpool,android-audiomanager,headphones
In my application, there is one Card Reader which uses Audio Jack of devices.Now, my problem is I want to produce sound from built-in speakers when Card Reader is intact in HeadPhone Jack of the device. Here are the codes I have tried: 1) Using Reflection Methods Class audioSystemClass; try...

How to force all sounds to shut down


java,android,audio
I'm making an application that makes a sound when a particulate thing happens, I made an other Layout that contains a button to stop that sound but the problem is that whenever I say MediaPlayer.stop();the application on the emulator or even on my mobile says the application has stopped The...

How do i play a sound in python 3?


python,audio,pygame
I wanted to write a python script to play a sound (recorded using windows recorder)! I read pygame can do the job and installed pygame! But I don't know how to write a code that plays a sound from a specific path! I have to play an audio file located...

Javascript alert box blocks sound object


javascript,audio,alert
I have a small problem. Basically, I am trying to make an application that it will pop up a box while playing a certain sound. Here is the fault part of the code: var audio = new Audio('song.mp3'); audio.play(); alert(1); The problem is that the audio plays after the alert...

Instantiating a SoundFile object within a class in Processing


audio,processing
I am attempting to create an instance of the SoundFile type inside of another class in Processing (the latest version, 3.0a10). I can easily play a sound that is defined outside of a class, as follows: import processing.sound.*; SoundFile clickSound; void setup() { size(600, 600); clickSound = new SoundFile(this, "bike-passing-by.wav");...

video to audio file convert & save through FFMPEG in node js


javascript,node.js,audio,video,ffmpeg
I am working on an FFMPEG on node js. I'd like to retrieve the audio track from a video file using node js. I would also like to save such file but I can't figure out how. I though this line of code would help me : ffmpeg('/path/to/file.avi').noVideo(); I have...

Custom audio player issues


javascript,css,html5,audio
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <style type="text/CSS"> #custom{ font-family: monospace; font-size: 16px; max-width: 650px; border-style: solid; border-color: black; border-width: 1px; border-radius: 5px; padding: 8px; padding-bottom: 15px; padding-left: 12px; padding-right: 12px; } img{ margin-top: 3px; float: left; } #bar, #currentTime, #duration, #skip{ display: inline-block; } #currentTime, #duration, #skip{ margin: 0px;...

Raspberry PI USB to RS232 adapter Receiving Only Ctrl Chars


python,serial-port,raspberry-pi,pyserial
I'm using a USB to RS232 cable for get communication with a pure rs232 device. With pyserial lib a got this code running in loopback tx -> rx cable pins. Setting the port: def __init__ (self, baudrate,timeout,parity,stopbits,bytesize): try: #self.s = serial.Serial(port="'/dev/ttyUSB0'",baudrate=baudrate,timeout=timeout,parity=parity,stopbits=stopbits,bytesize=bytesize) #self.s = serial.Serial("/dev/ttyUSB0",9600) self.s=serial.Serial( "/dev/ttyUSB0", baudrate=9600, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE,...

How do I swap stereo channels in raw PCM audio data on OS X?


audio,aiff
I'm writing audio from an external decoding library on OS X to an AIFF file, and I am able to swap the endianness of the data with OSSwapInt32(). The resulting AIFF file (16-bit PCM stereo) does play, but the left and right channels are swapped. Would there be any way...

Callback for connected/unconnected device using portaudio?


c++,audio,portaudio
Is there a callback to know when the device list is updated? If not, is there a way of detecting it ( ideally cross platform )? At the moment the only way i found is to re-initialise PortAudio. ps: I tried to find "callbacks" documentation on PortAudio documentation but i...

onended audio event firing without playing the audio


javascript,html5,audio,javascript-events
I have multiple audio files that i need to be played. and only when all audio has been played completely the next section is supposed to show. the code that i've written fires automatically without playing any audio. how should i do it? here's my code <!DOCTYPE html> <html> <body>...

play audio periodically from a memory stream c#


c#,audio,windows-phone-8.1,memorystream
I have some buffer containing samples of sinus which I want to be played from a memory stream periodically. Is there any efficient way to play it without having gaps in time? I try to make my own signal generator (I know that are some libraries providing that but I...

How to install shared library and include files manually in linux?


linux,opencv,cmake,raspberry-pi
I am trying to build and install TBB library from source so that it can be used for OpenCV to take advantages of multiple cores on my raspberry pi. I was able to build TBB from source without any problems using this steps. (Source : How do I build OpenCV...

VoIP limiting the number of frames in rendercallback


ios,objective-c,audio,core-audio,audiounit
I am currently developing a VoIP application and one of the libraries I am using requires me to send the frames in the input call back. The requirements is that I must send a sample count which is defined as the number of samples in a frame. This callback will...

C++ chrono library on Raspberry Pi


c++,raspberry-pi,c++14,chrono
On a Raspberry Pi 2, I need to call a php file on a regular basis, typically every 100ms. I found this c++ code which looks like it does what I need and a test version of it compiles and runs fine using CodeBlock on Windows. I've updated the wheezy...

Stream.CopyTo(newStream) return Length 0


audio,windows-phone-8.1,memorystream
I try to make some concatenation of buffers which are saved in a memory streams. Then, when I'm trying to play the whole buffer it gives an exception: An exception of type 'System.ArgumentException' occurred in Microsoft.Xna.Framework.ni.dll but was not handled in user code Additional information: Ensure that the buffer length...

How do I Mute The Audio In Unity 3D?


c#,audio,unity3d,mute
with script this. what is wrong in script this ? audio.mute = ToggleButton.isSpeakerOff; sorry bad english,fast answer please correct my script please...

Unity 5 Audio Volume Slider (Solved)


c#,audio,unity3d
I am trying to create an slider that I can use for volume control in Unity 5 but the volume will not change. My Game Objects are called MainMusicPlayer for the audio source and Volume Slider for the slider I am going to post the whole script as it would...

mediaelement.js - How to change width


javascript,audio,media-player,mediaelement.js,mediaelement
I have tried to find which of the plethora of tags controls the width of the mediaelement.js audio player but can't seem to work it out. I'm assuming it's a combination of the tags that need to be edited? I downloaded the player from the mediaelemenjs.com and the CSS for...

Updating An Image on All instances of a website


php,jquery,html,ajax,raspberry-pi
So I have a Raspberry Pi controlling my Garage door. The Pi is running an apache webserver. I also have a camera connected to the raspberry pi and I want to be able to update the images from the camera. Currently I have the following code: garage.html: <html> <head> <meta...

How deploy an large number iBeacons


bluetooth,raspberry-pi,bluetooth-lowenergy,uuid,ibeacon
I want deploy a large number of iBeacons with the same UUID because we can't access dynamically to the UUID of the beacons detected. What is the limit number of the maximum Beacons with the same UUID ? I found some discussions with a number of 65000 approximately, is it...

setInterval doesn't get cleared, function keeps getting executed


javascript,node.js,socket.io,raspberry-pi
I have the following function: function monitorClimate() { var sensorReadingInterval; function startClimateMonitoring(interval) { sensorReadingInterval = setInterval(function() { io.emit('sensorReading', { temperature: sensor.getTemp() + 'C', humidity: sensor.getHumidity() + '%' }); }, interval); console.log('Climate control started!'); } function stopClimateMonitoring() { clearInterval(sensorReadingInterval); console.log('Climate control stopped!'); } return { start: startClimateMonitoring, stop: stopClimateMonitoring }; }...

My While True loop is getting stuck in python


python,while-loop,raspberry-pi,infinite-loop,raspbian
Hello I have been working on an infinite While True loop for the main file in my python code. I am working on a Raspberry Pi and my goal is that whenever one of the GPIO Pins senses an input it will print out a string. However When I push...

Why doesn't “Set-Item” work on Windows 7 PowerShell?


windows,powershell,raspberry-pi
I am trying to install Windows 10 IoT on my Raspberry Pi 2. The PowerShell documentation tells me to put in this: Set-Item WSMan:\localhost\Client\TrustedHosts -Value <minwinpc> However, when I put it into my Windows 7 PowerShell, this comes out: At line:1 char:54 + Set-Item WSMan:\localhost\Client\TrustedHosts -Value <minwinpc> + ~ The...

Audio not working in Javascript


javascript,html,audio
I'm trying to get audio to play in general, but it does not seem to be working. I thought perhaps the interval or if statements were stopping it from playing, but as you can see even a call before all that does not make any sound. The directory is in...

With NAudio howto capture an signal played


.net,audio,naudio
Is there any way to capture a sound signal being played (by another application) in .NET (with or without the NAudio library)? What I want to do is build an graphical visualization of the sounds played (like there are plenty apps), but without playing the sound itself (which seems non...

AVAudioPlayer wont play sound when called in other swift file


ios,swift,audio,avaudioplayer
I have two swift files - my ViewController:UIViewController and AudioPlayer:AVAudioPlayer. My AudioPlayer file has this function func seaGullSound() { var tmp = AVAudioPlayer() var seaGullSound = NSURL(fileURLWithPath: NSBundle.mainBundle().pathForResource("Gulls", ofType: "mp3")!) AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayback, error: nil) AVAudioSession.sharedInstance().setActive(true, error: nil) var error:NSError? tmp = AVAudioPlayer(contentsOfURL: seaGullSound, error: &error) tmp.prepareToPlay()...

Tried multiple solutions onsite, none worked: Play


javascript,jquery,html5,audio,interactive
This is my first question on Stack Overflow! :D There appear to be multiple similar questions, but I have tried each solution and none of them are working, and yet I'm determined to get to the bottom of this. The goal is to play audio upon successful konami code entry....

Unity3d AudioSource not creatable


c#,audio,unity3d
I have a strange problem in unity3d. I want to use several audio sources for playing a sound with a overlapping effect. Because I can't explain the problem myself- I tried the same with only one AudioSource. So I have this script: public class audioOverlap:MonoBehaviour { private AudioSource sct; public...

iOS Swift: Sound not playing on iPhone Simulator


ios,iphone,swift,audio,ios-simulator
In my iOS Swift application, and i am trying to play sound on click of a button. func playSound() { var audioPlayer = AVAudioPlayer() let soundURL = NSBundle.mainBundle().URLForResource("doorbell", withExtension: "mp3") audioPlayer = AVAudioPlayer(contentsOfURL: soundURL, error: nil) audioPlayer.play() } I am running the application in iOS iPhone Simulator. I have doorbell.mp3...

Java read bytes from Socket on Linux


linux,windows,sockets,network-programming,raspberry-pi
I'm trying to send a file from my Windows machine to my Raspberry-Pi 2, and I have a client and a server. The client should be able to send a zip file over the network to my server on my linux machine. I know my client and server work on...

Popen.kill() failing


python,raspberry-pi
Update 2: So I piped the output of stderr and it looks like when I include shell=True, i just get the help file for omx player (it lists all the command line switches and such). Is it possible that shell=True might not play nicely with omxplayer? Update: I came across...