티스토리 뷰
ㄴㅇ
https://www.devicemart.co.kr/goods/view?no=1290797
아두이노 LM386 디지털 앰프 모듈 (스피커 포함) [ELB060302]
아두이노와 호환되는 LM386 앰프 모듈입니다. 0.5W, 8Ω 스피커가 포함되어 있습니다.
www.devicemart.co.kr
5V
음성출력은 아두이노 pin3으로 고정되어 있음
IN - A3
https://m.blog.naver.com/bitelab/221892417268
[Bitelab] 아두이노 스피커 모듈 lm386을 이용하여 노래 만들기
아두이노 스피커 모듈 lm386을 이용하여 노래 만들기 간단한 아두이노 스피커 모듈을 활용하여 노래를 만들...
blog.naver.com
wav파일을 재생하려면 SD 카드가 있어야한다는데 나는 없다 .
간단한 효과음을 재생할거라... 일단
바이트 코드(숫자)로 변환하여 재생해보자.
1. Audacity 사용: 먼저, Audacity 같은 오디오 편집 프로그램을 사용하여 .mp3 파일을 엽니다. 이 프로그램은 무료로 사용 가능하며, 다양한 오디오 형식을 편집하고 변환할 수 있습니다.오디오프로그램 다운로드 사이트 (무료)
Audacity ® | Free Audio editor, recorder, music making and more!
Record anything Excellent for podcasts, voice-over work or even just recording memos.
www.audacityteam.org
- 오디오 다운로드 : 무료
https://pixabay.com/sound-effects/sear
- 오디오 형식 변환: 오디오 파일을 16비트 PCM 형식으로 변환하고, 플레이백 속도를 가능한 낮은 값으로 설정합니다. 이렇게 하면 Arduino가 처리할 수 있는 형태로 오디오 데이터가 변환됩니다.
- 오디오 내보내기 : 8000hz mono mp3
- 오디오 데이터를 바이트 코드로 변환: 변환된 오디오 파일을 바이트 코드로 변환하는 프로그램을 사용합니다. 이러한 도구는 온라인에서 찾을 수 있으며, 오디오 파일을 업로드하고 Arduino에서 사용할 수 있는 바이트 배열로 변환해 줍니다.
- JSON은 바이너리 데이터를 직접 지원하지 않는 텍스트 형식이므로, Base64 인코딩을 사용하여 바이너리 데이터를 텍스트로 변환해야 합니다.
- https://base64.guru/converter/decode/hexBase64는 오디오를 문자로 바꿔줌
- hex 로 변환 : 숫자
- 튜토리얼은 10진수임.. GPT로 바꿔줬음.
- Arduino 코드에 포함: 변환된 바이트 배열을 Arduino 스케치에 포함시킵니다. 이 배열은 Arduino 프로그램이 오디오 데이터를 직접 처리하고 재생할 수 있게 해줍니다.
- 재생 코드 작성: Arduino 라이브러리를 사용하여 오디오 데이터를 재생합니다. 예를 들어, PWM 핀을 사용하여 오디오 신호를 생성하고, 이를 스피커에 연결하여 재생할 수 있습니다.
hex_string = "-----숫자"
hex_values = hex_string.split(",")
# Convert each hex value to decimal and store in a new list
decimal_values = [int(value, 16) for value in hex_values]
# Create a continuous, comma-separated string of decimal values
decimal_string = ",".join(map(str, decimal_values))
# Specify the path to the file where you want to save the decimal values
output_file_path = "경로/hex_to_decimal.txt"
# Write the decimal values to the specified file
with open(output_file_path, "w") as file:
file.write(decimal_string)
print("Conversion completed. Decimal values saved to", output_file_path)
Base64 to Hex | Base64 Decode | Base64 Converter | Base64
The “Base64 to Hex” converter is a free tool which is able to convert online Base64 strings to Hex values. The conversion process is quite simple: the converter decodes the Base64 into the original data, then encodes it to Hex value and gives you the f
base64.guru
예제코트
#include <pn512_cmd.h>
const unsigned char mp3 [] PROGMEM= {
소리데이터 (byte 숫자 10진수? 100,122,123, ...)
};
voide setup()
{
}
vode loop()
{
startPlaybak(mp3, sizeof(mp3));
delay(4000);
}
---
PCM 라이브러리 설명서에 들어가면.. 너무 친절하게 하는법 설명되어있어서 위의일 .. 안해도 될지도.
https://highlowtech.org/?p=1963
Simple Arduino audio samples
This tutorial explains how to do simple playback of short (~4 second), low-bitrate (8 KHz) audio samples from Arduino using only a speaker.
highlowtech.org
이것도 귀찮다.
다음에는 그냥 이거사자
https://www.devicemart.co.kr/goods/view?no=1278727
'Iot > Arduino' 카테고리의 다른 글
미니모터(ja12-n20) +아두이노 + 드라이버 (HG7881) (0) | 2024.03.30 |
---|---|
아두이노 + LED strip (6812 RGBW) (0) | 2024.02.21 |
아두이노에 여러개의 센서 연결하기 (DS18B20 온도센서) (0) | 2024.02.21 |
아두이노 조도센서 모듈 [SEN030101] (0) | 2024.02.20 |
arduino_스테핑 모터step type 103H5210-0457산요덴키 (0) | 2024.02.20 |
- Total
- Today
- Yesterday
- krea
- AI
- three.js
- Python
- sequelize
- VR
- Java
- MQTT
- Express
- Midjourney
- 유니티
- imgtoimg
- google ai studio
- opencv
- CNC
- colab
- node.js
- runwayai
- ai film
- RNN
- 라즈베리파이
- Arduino
- houdini
- oculuspro
- DeepLeaning
- docker
- Unity
- 후디니
- ai image generator
- TouchDesigner
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |