Skip to content

Instantly share code, notes, and snippets.

#pydub のインポート
from pydub import AudioSegment
from pydub.silence import split_on_silence
import glob, os
files = glob.glob("C:/temp/*.mp3")
for file in files:
sound = AudioSegment.from_file(file, format='mp3')
dname = os.path.dirname(file)
fname = os.path.splitext(os.path.basename(file))[0]
@7m4mon
7m4mon / openai_folder_waves_to_text.py
Created December 13, 2023 11:50
フォルダの中のwavファイルを一括で文字起こしする。
# -*- coding: utf-8 -*-
# 参照元:https://di-acc2.com/programming/python/25061/
# フォルダの中のwavファイルを一括で文字起こしする。
import openai, os
openai.organization = "org-xxxxxxxxxxxxxxxxxxxxxxxx"
openai.api_key = "sk-zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
import glob
@7m4mon
7m4mon / conbine_wavs.py
Created December 13, 2023 11:45
フォルダ内のwavファイルを連結して保存する
# -*- coding: utf-8 -*-
# フォルダ内のwavファイルを連結して保存する
import glob
from pydub import AudioSegment
files = glob.glob("C:/tmp/*.wav")
sound = AudioSegment.empty()
for file in files:
print(file)
@7m4mon
7m4mon / openai_speech_to_text.py
Created August 1, 2023 13:20
openai_speech_to_text.py
# -*- coding: utf-8 -*-
# 参照元:https://di-acc2.com/programming/python/25061/
# に、テキストファイルの保存を追加しただけ。
import openai, os
openai.organization = "org-xxxxxxxxxxxxxxxxxxxxxxxx"
openai.api_key = "sk-zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
# 音声ファイルのパスを指定 mp3, mp4, wav, mpeg, mpga(25MB以下)
' サンハヤトの Sample_MMCP2112_MMTXS03 からGPIO4を操作する部分を抜き出し
' 割と忠実にExcel VBAに移植してみた。
' 2020/03/18 7M4MON
' 動作環境 Windows10 64Bit + Excel 2010 32bit + Sunhayato MM-CP2112A
' HID USB to SMBus Master Bridge USB・I2C(SMBus)変換モジュール
' *** 準備 ***
' * SLABHIDDevice.dll と SLABHIDtoSMBus.dll を C:\Windows\SysWOW64 にコピーしておく
' * SLABCP2112.bas をインポートして、オブジェクト名を [CP2112_DLL] にする
"""=================================================="""
""" Super Hikari Mascon Decoder """
""" 2019.Sep.30 7M4MON """
"""=================================================="""
import numpy
import math
from gnuradio import gr
class masdec_ii(gr.sync_block):
/*
* Display the Bitmap file saved on the SD card in a 16 x 32 dot full color LED matrix with Arduino nano.
* 7M4MON, 2019-Sep-20
* SDカードに保存されている Bitmapファイルを、16 X 32 ドットのフルカラーLEDマトリクスに表示します。
* ① 12個のボタンを搭載し、ボタンが押されたらそのボタンに紐付いたビットマップファイル( [1-6], [A-F] .BMP )を 表示します。
* ② SerialPort / USB で指定されたビットマップファイルを表示します。
*  例: UARTから 'A' を送る→ 'A.BMP' を表示
*
* mixiの技術スレッドで公開されていたコードに操作部を追加したもの。
* https://mixi.jp/view_bbs_comment.pl?comment_number=26&community_id=447391&bbs_id=76480266
///////////////////////////////////////////
// LCD test program for ccs-c
// lcd.c was defined to lcd_b.c
//
// As Defined in the following structure the pin connection is as follows:
// B0 enable
// B1 rs
// B2 rw
// B4 B4
// B5 B5
'================
' Felicaの非保護領域に任意のデータを書き込むテストプログラム
' 2016年03月20日 7M4MON
'
' 白執事さんの下記ページのプログラムをちょっと変更して読み書き出来るようにした。
' http://siroshitsuji.blog.fc2.com/blog-entry-18.html
'================
Public Class frmMain
'================
/*
* ふみきりのオモチャ
* 2018/02/28 7M4MON
* Memory usage: ROM=19% RAM=16% - 19%
*/
#include <12f683.h> // サーボを使うのでCCPモジュールがある683を選定
#fuses INTRC_IO, NOWDT, PUT, NOPROTECT, NOMCLR, NOBROWNOUT
#use Delay(CLOCK=4000000) // 1cycle = 1us
#use fast_io(a)