Git Product home page Git Product logo

autoanalogaudio's People

Contributors

2bndy5 avatar dwootton avatar guzu1987 avatar ivankravets avatar mmeisel avatar tmrh20 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

autoanalogaudio's Issues

Problem with ADC read

Hi, I used your lib and have some problem with adc :)
I used it with adcChannel = ADC1_CHANNEL_5; and I need get value from analogRead(36).
When program comes to line with analogread it freeze.
I try adc1_get_raw(ADC1_CHANNEL_0) and still the same.
Is there any way to use lib and read value from ADC1_CHANNEL_0 ?

Need of a ADC to DAC pass-through example

Could you provide an example .ino file that reads from the ADC with a fixed sampling rate and outputs it to the DAC? That would be very useful for a guitar effects project on the Arduino Due, for example.

I've been trying to code a pass-through using this library, but I couldn't quite make it...

Here's what I tried so far: https://gist.github.com/dangpzanco/10cd9ec34a38702c66015a535b142042

Edit: That code was functional, but the sound quality is awful... Maybe because the library sets up two timers, one for the ADC and another for the DAC?

aaAudio.begin() affects SPI Bus

The begin() function in the aaAudio library seems to be affecting the SPI bus. Attempts to find files, both images and sound, on an SD card after calling this function work, at best, only some of the time. This behavior is occurring on an Arduino Due.

Playback problem

Hi,
tried to use ur library to output number generated wav file, but can't get it to work. There is no playback sound at all. SDAudioBasics example working just fine (with that switch operator). I'm using Arduino Uno, here's code I'm using - basically generate random number up to 27 (which is last file on sd card -> "27.wav"), then checks if sensor value is above limit, if so the playback should occur. Thanks in advance.

#include <SPI.h> #include <SD.h> #include <AutoAnalogAudio.h> AutoAnalog aaAudio; void DACC_Handler(void) { aaAudio.dacHandler(); } int input = A4; int output = 8; int val = 0; void setup() { Serial.begin(115200); randomSeed(analogRead(A5)); pinMode(input, INPUT); pinMode(output, OUTPUT); if (!SD.begin(10)) { Serial.println("SD fail"); return; } else { Serial.println("SD ok"); } aaAudio.begin(0, 1); aaAudio.autoAdjust = 0; aaAudio.dacBitsPerSample = 8; aaAudio.setSampleRate(16000); } void loop() { val = analogRead(input); char buffer[10]; char buffer2[20]; int rand = random(1, 28); sprintf(buffer, "%d.wav", rand); sprintf(buffer2, "Status sensora: %d", val); Serial.println(buffer2); if (val > 10) { digitalWrite(output, HIGH); delay(500); Serial.println(buffer); //debug playAudio(buffer); } else { delay(500); digitalWrite(output, LOW); } loadBuffer(); } File myFile; void playAudio(char *audioFile){ if (myFile) { myFile.close(); } myFile = SD.open(audioFile); myFile.seek(44); loadBuffer(); } void loadBuffer(){ if(myFile.available()){ for(int i=0;i<32;i++){ aaAudio.dacBuffer[i] = myFile.read(); } aaAudio.feedDAC(0,32); } }

Example Confusion of hardware definition

Hi, I'm new to Arduino.

My goal is to continues recording using buffer for long hours without the need to play wav files. Currently, I'm trying to test your code in my Arduino Due, MicroCard adapter and MAX9814. I understand 85% of it and try to create my own version however all the example seems to has been modify for ESP32.

  1. Seems like example of ESP32 in AutoAnalogAudio/examples/SDAudio/SdAudioRecording/ has adcbuffer while older version of this example did not called this function. This confused me.

  2. The example in AutoAnalogAudio/examples/SDAudio/SdAudioRecording/ also have stopRecording function that are far different than this version. I assume this also related to adcbuffer.

Useing AAAudio for rec sound's from mic with esp32

Hi Mr
I want to use this library to record a wav file with a microphone connected to esp 32 dev kit, but my problem is when recording the file because it starts working by pressing the 9 key first, but after pressing the 0 button for a few seconds To stop recording, this message is displayed File contains no data, exiting , and nothing is actually recorded
I used an onboard ADC 34 pin and also had another problem with this library at first and it was in the sd.h library because this library did not match esp 32 and it showed the error Failed to open file that I changed the sd.h library I fixed this error with mySD.h
What do you think is the problem for recording?
please...

differences with rf24audio?

Hi,
I was looking at this new library. Which are the differences with rf24audio library?

I want to send audio from a nord to the master using the radios. Which library is better?

Thanks!

Microphone problem

When i use sd audio recording example with esp32 it show i2s0 is not intialised yet , is this example use i2s microphone

SimpleSine12Bit error

Minor artifact, if you look at scope of DAC output for example SimpleSine12Bit. Wavefrom at peak drops to zero for one sample, need to replace 0x1000 table value with 0xfff

SD compability

Hi, I'm using Arduino Due.
My goal is to write and save an audio with 8bit and sr = 16kHz to sd card. I'm using SdFat32. I have test run all component by itself however when I tried to combine SdFat32 and modify the code from your example, I can not initiate SdFat32 at all. It always gave me an error(can not find SdFat32).

Thank you in advance. I really looking forward to hear from you.

Low / Distorted Input and Output

Hi!

Using an Arduino Nano clone with the library. Reading in audio from a keyboard (Casio Sk-1) at line level. Inputting to A0 and outputting to 9 as per docs.

Audio is successfully being read in and output through DAC to a 4ohm speaker and a rca output, but the audio is extremely distorted. Here's the wave being read in:

Untitled

I tried using a PAM8403 breakout for amplification in but it didn't output anything useful. Still getting relatively low levels in.

When I plug into a power amp via rca it's EXTREMELY loud and distorted.

Thanks for help & for the wonderful library!

and simple code to recreate:


AutoAnalog aaAudio;
void DACC_Handler(void) {
  aaAudio.dacHandler();
}

void setup() {

  pinMode(A3, OUTPUT);
  digitalWrite(A3, HIGH);

  Serial.begin(115200);

  aaAudio.begin(1, 1);
  aaAudio.autoAdjust = 1;
  aaAudio.dacBitsPerSample = 8;
  
  aaAudio.getADC(32);
}

void loop() {

  aaAudio.feedDAC(0, 32);
  aaAudio.getADC(32);

  for (int i = 0; i < 32; i++) {
    aaAudio.dacBuffer[i] = aaAudio.adcBuffer[i] << 2;
    Serial.println(aaAudio.dacBuffer[i]);
  }
}

Communication problem

Hello,
I'm stuck on a problem regarding the communication between a sender device and a receiver (both arduino DUE with nrf24l01+).

Firstly, if i run pingpair_ack from rf24-library example then everything is working (I can see the ping-pong packet flowing with acks). But I had no succes with the SimpleSine deployed to the sender, and the WirelessSpeaker deployed to the receiver.
Same bad result with audioRadioRelay deployed on both devices.

The first debugging shows that the RX() function on the receiver is called only one time with pipeNo=0 but then it never goes inside the while (radio.available(&pipeNo)). So it seems to me that no radio data is available to the receiver.

If I deploy the SimpleSine and WirelessSpeaker, am I suppose to listen the sine from the DAC0 of the receiver without any change to the code? The sine plays well from the DAC0 of the sender..

Thanks for the support

AutoAnalogAudio.h conflicts with Audio.h library

Hi dear, I'm having an issue with the AutoAnalogAudio.h , I'm using esp32 board. The problem happens
when I include in my project the Audio.h library, I upload my code to the board no problems but when
I use the Audio.h library the library throws this message:

Analog Audio Begin
E (37) I2S: /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/driver/i2s.c:1252 (i2s_adc_enable):i2s built-in adc not enabled

It says "i2s built-in adc not enabled" I don't know if there is a way to enable adc, I'm not esp32 expert, it is for that reason that I'm writing this issue to ask for help.

The library AutoAnalogAudio.h works well when I record audio, however when I include the Audio.h library it throws that message and I'm no unable to record audio because the board starts to reboot.

Here is code:

// esp32 board v.1.0.6
#include <SPI.h>
#include <SD.h>
//=================================================
#include <AutoAnalogAudio.h>

#define SD_CS_PIN 5
#define AUDIO_DEBUG
#define RECORD_DEBUG

AutoAnalog aaAudio;
File myFile;
File recFile;
#include "myWAV.h"
#include "myRecording.h"

const char newWavFile[] = "/record.wav";


//=================================================

//SD:
#define SD_MISO     19
#define SD_MOSI     23
#define SD_SCLK     18
#define SD_CS       5


//Amplifier MAX98357 PINS:
#include "Audio.h"
Audio audio;

#define I2S_DOUT      25 //DIN PIN
#define I2S_BCLK      27
#define I2S_LRC       26


void setup() {
  Serial.begin(115200);
  pinMode(SD_CS, OUTPUT);
  if (!SD.begin(SD_CS)) {
    Serial.println("SD init failed!");
    return;
  }
  Serial.println("SD ok\nAnalog Audio Begin");
  
  
  // AutoAnalogAudio.h
  aaAudio.begin(1, 1);     // Start AAAudio with ADC & DAC
  aaAudio.autoAdjust = 0;  // Disable automatic timer adjustment

  //set Audio.h
  audio.setPinout(I2S_BCLK, I2S_LRC, I2S_DOUT);
  audio.setVolume(10); // 0...21

}

uint32_t displayTimer = 0;
bool recording = false;


void loop() {
   //"Audio.h"
  // audio.loop();

   
  //AutoAnalogAudio.h
  if (millis() - displayTimer > 1000) {
    displayTimer = millis();
    if (counter) {
      Serial.print("Samples per Second: ");
      Serial.println(counter * MAX_BUFFER_SIZE);
    }
    counter = 0;
  }

  if (Serial.available()) {
    char input = Serial.read();
    switch (input) {
      case 'r':  startRecording(newWavFile, 24000); recording = true; break; //Start recording @11khz,8-bit,Mono
      case 's':  stopRecording(newWavFile, 24000);  recording = false; break; //Stop the recording and finalize the file
      case 'p':  playRecordedAudio(newWavFile);      break; //Play back the recorded audio
      case 'D':  SD.remove(newWavFile);      break; //Delete the file and start fresh
    }
  }

#if defined (ESP32)
  if(recording){
    ADC_Handler();
  }
#endif


}

void playRecordedAudio(const char *file){
//   audio.setVolume(10); // 0...21
  // audio.connecttoFS(SD, file);
   
}


// optional
void audio_info(const char *info){
    Serial.print("info        "); Serial.println(info);
}
void audio_id3data(const char *info){  //id3 metadata
    Serial.print("id3data     ");Serial.println(info);
}
void audio_eof_mp3(const char *info){  //end of file
    Serial.print("eof_mp3     ");Serial.println(info);
}
void audio_showstation(const char *info){
    Serial.print("station     ");Serial.println(info);
}
void audio_showstreaminfo(const char *info){
    Serial.print("streaminfo  ");Serial.println(info);
}
void audio_showstreamtitle(const char *info){
    Serial.print("streamtitle ");Serial.println(info);
}
void audio_bitrate(const char *info){
    Serial.print("bitrate     ");Serial.println(info);
}
void audio_commercial(const char *info){  //duration in sec
    Serial.print("commercial  ");Serial.println(info);
}
void audio_icyurl(const char *info){  //homepage
    Serial.print("icyurl      ");Serial.println(info);
}
void audio_lasthost(const char *info){  //stream URL played
    Serial.print("lasthost    ");Serial.println(info);
}
void audio_eof_speech(const char *info){
    Serial.print("eof_speech  ");Serial.println(info);
}

I will appreciate any idea to fix this problem.
thanks so much.

The Audio.h library is from here:
ESP32-audioI2S https://github.com/schreibfaul1/ESP32-audioI2S

thanks.

max 9814 record

Hi, is there any solution how to record from max 9814? I try record by this mic, but recorded file is so distorted and indistinct.

Can we get support esp8266 board?

I am trying to use a microphone with my NodeMCU V2 board and stream audio PCM data to a service over WIFI. I am using PlatformIO IDE to program this board. Last time I tried using this, it gave an error(undefined reference to functions) while compiling to ESP8266 target. I am not sure it is because of lack of support for ESP8266 board or I am missing some compiler options. Could someone help? @TMRh20

esp32 support

Does this library support esp32?

I tried but receive a lot of errors, especially with the registers.

I can't make it stream over radio nrf24l01.

Tried with pro micro and teensy 2.0, esp32 firebeetle, atmega2560.
Tried WirelessMicrophone, WirelessSpeaker.I put a microphone on the sender pin A0(I could see the signal with the oscilloscope) and probed all the pins on the receiver and nothing.
(attachInterrupt(digitalPinToInterrupt(4), RX, FALLING); does not work, there is no signal activity on the nrf24l01 pins; I put RX(); in loop and I see activity)

I used SimpleSine example on the sender(I could see the signal on the sender pins 9,10), uncommented lines to enable radio, probed all pins on the receiver and nothing.

Simple radio example hello world works.

Which code Example can i use to record sound with the Arduino Due

Hello @TMRh20 I have made a connection to the arduino due using a max4466 mic as well as an sd card, tried using the sdaudiorecording library but it keeps popping an error failed to start recording, could you help with an example that I could use with the arduino due to be able to acquire an audio sample from the mic, thank you

Can't compile for any arduino board?

TMRpcm couldn't compile for Arduino micro (just using to test your libraries first) but I get error fastadc:50:21: error: 'class TMRpcm' has no member named 'startRecording' same for stopRecording. So I turned to try AAAudio. Both libraries were installed by searching inside Arduino ide library manager. I tried running the SimpleADCStream example but get error ```C:\Users\AKIRA~1.KAT\AppData\Local\Temp\ccK7SMga.ltrans0.ltrans.o: In function `__vector_13':

C:\Users\akira.kato\Documents\Arduino\libraries\AutoAnalogAudio\src\avr/AutoAnalogAudio.cpp:212: undefined reference to `DACC_Handler()'

collect2.exe: error: ld returned 1 exit status ```. I try setting board to Arduino nano to try to just compile since it saids in wiki it works but the compilation failed for same error.

Sdfat

Any instructions on how to use with SDfat? also does it work on a Arduino Zero?

Recording speed

Iam using AutoAnalogAudio library for Audio Recording using esp32 but my audio recording speed is too fast is there is any solution for that

AutoAnalogAudio

Hi Mr
Is AutoAnalogAudio work with esp32 boards?
And if it works, with what kind of esp32 board's?

Undetected type when using Arduino IDE

c:\Users\*****\OneDrive\Documents\Arduino\libraries\AutoAnalogAudio\src/AutoAnalogAudio.h:258:3: error: 'adc1_channel_t' does not name a type; did you mean 'i2s_channel_t'?
   adc1_channel_t adcChannel;
   ^~~~~~~~~~~~~~
   i2s_channel_t

I'm using the Arduino IDE to try to record audio using the XIAO Sense and an external electret microphone. I followed the setup outlined in the documentation before uploading any code. I'm wondering if there's a missing dependency that wasn't installed initially or if it's a more underlying issue.

Use on new Nano33BLE format boards

G'day

I have been looking for a solution to play one and two word audio/pcm files from flash memory on the Nano33BLE board with no luck. The many solutions for this on other Arduino format boards don't work on the Nano33BLE.

Is there a solution with this player that someone can help me with?

Record sound from esp-cam

Is it possible to stream not only video but also audio with esp-cam?

Esp-cam has pinout gpio12 ~ gpio14 that can do adc ,but these pins are of adc2,and i2s driver seems to be hard coded with adc1

This article says adc2 is use by WiFi on esp dev board,I guess it likely the same with esp-cam

esp-cam pinout and schematic
https://randomnerdtutorials.com/esp32-cam-ai-thinker-pinout/

That's too deep for me. I wonder if you are interested and have time to look into this question

Compile error for ESP32-S3

Hey there!

Whenever I try to compile even the basic examples included in this library for my ESP32-S3 (Adafruit Feather ESP32-S3 TFT) I get the following error. I'm no pro with Arduino and C/++ in general and I can't really pinpoint the error source, but I think it could be related to the ESP32-S3 being rather new and this lib maybe not updated yet?

libraries/AutoAnalogAudio/src/AutoAnalogAudio.h:235:3: error: 'adc1_channel_t' does not name a type; did you mean 'i2s_channel_t'?
   adc1_channel_t adcChannel;
   ^~~~~~~~~~~~~~

Cheers!
Philipp

problems with esp32

sup guys, i was trying to record some stuff with a old mic module and the esp32 module by itself, with sd card. but im having this problem when i send de record option to serial monitor, as you can see below
imagem_2024-02-12_200421925

im using the sdaudiorecording.ino example, an esp32 regular board and an analog mic
by the way sorry for the bad english :(

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.