- プロンプト実行例
こんにちは!
かっこいい曲
かっこいいロック調のBGMを生成します。力強いベースラインとエネルギッシュなリズムを特徴としています。
html1<!DOCTYPE html> 2<html> 3<head> 4 <title>Cool Rock BGM</title> 5 <style> 6 button { 7 padding: 10px 20px; 8 font-size: 16px; 9 margin: 10px; 10 } 11 </style> 12</head> 13<body> 14 <button onclick="startBGM()">Play</button> 15 <button onclick="stopBGM()">Stop</button> 16 <input type="range" min="0" max="100" value="70" oninput="changeVolume(this.value)"> 17 18<script> 19let audioContext; 20let gainNode; 21let isPlaying = false; 22let scheduledNotes = []; 23 24const BPM = 140; 25const BEAT_LENGTH = 60 / BPM; 26 27function initAudio() { 28 audioContext = new (window.AudioContext || window.webkitAudioContext)(); 29 gainNode = audioContext.createGain(); 30 gainNode.connect(audioContext.destination); 31 gainNode.gain.value = 0.7; 32} 33 34function createOscillator(freq, type, startTime, duration) { 35 const osc = audioContext.createOscillator(); 36 const oscGain = audioContext.createGain(); 37 38 osc.type = type; 39 osc.frequency.value = freq; 40 41 oscGain.gain.setValueAtTime(0, startTime); 42 oscGain.gain.linearRampToValueAtTime(0.3, startTime + 0.01); 43 oscGain.gain.linearRampToValueAtTime(0, startTime + duration); 44 45 osc.connect(oscGain); 46 oscGain.connect(gainNode); 47 48 return osc; 49} 50 51const bassline = [ 52 { note: 49, duration: 0.5 }, // G1 53 { note: 49, duration: 0.5 }, 54 { note: 46, duration: 0.5 }, // F#1 55 { note: 49, duration: 0.5 }, 56]; 57 58const melody = [ 59 { note: 73, duration: 0.25 }, // G4 60 { note: 71, duration: 0.25 }, // F4 61 { note: 68, duration: 0.25 }, // D4 62 { note: 71, duration: 0.25 }, // F4 63]; 64 65function noteToFreq(note) { 66 return 440 * Math.pow(2, (note - 69) / 12); 67} 68 69function playSequence(startTime) { 70 const sequenceLength = 2; // 2秒で1ループ 71 72 // ベースライン 73 bassline.forEach((note, index) => { 74 const freq = noteToFreq(note.note); 75 const osc = createOscillator(freq, 'sawtooth', 76 startTime + index * BEAT_LENGTH, 77 note.duration); 78 osc.start(startTime + index * BEAT_LENGTH); 79 osc.stop(startTime + index * BEAT_LENGTH + note.duration); 80 scheduledNotes.push(osc); 81 }); 82 83 // メロディ 84 melody.forEach((note, index) => { 85 const freq = noteToFreq(note.note); 86 const osc = createOscillator(freq, 'square', 87 startTime + index * BEAT_LENGTH, 88 note.duration); 89 osc.start(startTime + index * BEAT_LENGTH); 90 osc.stop(startTime + index * BEAT_LENGTH + note.duration); 91 scheduledNotes.push(osc); 92 }); 93 94 // ドラム的なノイズ 95 for (let i = 0; i < 4; i++) { 96 const noiseOsc = createOscillator(150 + Math.random() * 50, 'square', 97 startTime + i * BEAT_LENGTH, 98 0.1); 99 noiseOsc.start(startTime + i * BEAT_LENGTH); 100 noiseOsc.stop(startTime + i * BEAT_LENGTH + 0.1); 101 scheduledNotes.push(noiseOsc); 102 } 103 104 if (isPlaying) { 105 setTimeout(() => { 106 playSequence(startTime + sequenceLength); 107 }, (sequenceLength - 0.1) * 1000); 108 } 109} 110 111function startBGM() { 112 if (!audioContext) { 113 initAudio(); 114 } 115 if (!isPlaying) { 116 isPlaying = true; 117 playSequence(audioContext.currentTime); 118 } 119} 120 121function stopBGM() { 122 isPlaying = false; 123 scheduledNotes.forEach(osc => { 124 try { 125 osc.stop(); 126 } catch (e) { 127 // 既に停止している場合のエラーを無視 128 } 129 }); 130 scheduledNotes = []; 131} 132 133function changeVolume(value) { 134 if (gainNode) { 135 gainNode.gain.value = value / 100; 136 } 137} 138</script> 139</body> 140</html>
この実装の特徴:
- パワフルなベースライン
- 低音域でのサwtooth波による力強い音色
- シンプルながらも印象的なフレーズ
- キャッチーなメロディ
- square波による特徴的な音色
- リズミカルなパターン
- ドラム的な要素
- ノイズ的な音を使用してリズム感を強調
- 規則的なパターンでグルーブ感を演出
- 音楽理論的な特徴
- Gマイナーをベースとした調性
- 4/4拍子の力強いリズム
- 140BPMの疾走感のあるテンポ
使い方:
- Playボタンで再生開始
- Stopボタンで停止
- スライダーで音量調整可能
注意点:
- ブラウザの自動再生ポリシーにより、ユーザーインタラクションが必要
- モバイルデバイスでの動作は端末の性能に依存
- メモリ使用量を最適化するため、停止時に不要なオシレーターを解放
コメント 0
他のプロンプトもチェック
GPTs
キャラクター作成
花押クリエイターは、日本の伝統的な署名や印「花押」のデザインをサポートするためのツールです。国内外のさまざまな文化背景を考慮し、名前やシンボルを基にした個性的で芸術的な花押デザインを提案します。 このツールは、歴史的な作法や文化的背景を尊重しながら、現代的なアプローチにも対応します。作成した花押のコンセプトや意図を分かりやすく説明し、カスタマイズや調整も簡単に行うことが出来ます。 初めての方から花押愛好家まで、どなたでもご利用いただける「花押クリエイター」で、あなただけの特別なデザインを作りませんか? GPTsストアで高評価していただけると嬉しいです。 #画像作成 #花押 #サイン722.72K6.19Kロールプレイ
推奨モデル - GPT 4o最強のアキネーターです。 いくつかの簡単な質問を基に、あなたが考えている有名なキャラクターや人物を当ててみせます! 最初に「動物」などのテーマを指定することもできます。111212.80Kチャットボット
推奨モデル - GPT 4oGPTs→🔗 https://oshiete.ai/items/103335417645641728 🎨 #ユーザーのゴール - AIが生成した文章を、人間が書いたように自然で説得力のある文章に変換すること - AI文章検出ツールを回避し、人間が書いた文章と見分けがつかないレベルに到達すること - 文章の本来の意図や内容を維持しつつ、文体や表現を改善すること1612735.30K