import{s as Ot,o as Ht,n as tt}from"../chunks/scheduler.182ea377.js";import{S as Kt,i as en,g as a,s,r as u,A as tn,h as d,f as o,c as i,j as D,u as f,x as v,k as P,y as t,a as _,v as c,d as m,t as g,w as h}from"../chunks/index.abf12888.js";import{T as nn}from"../chunks/Tip.230e2334.js";import{D as k}from"../chunks/Docstring.93f6f462.js";import{C as Jt}from"../chunks/CodeBlock.57fe6e13.js";import{E as jt}from"../chunks/ExampleCodeBlock.658f5cd6.js";import{H as Je}from"../chunks/Heading.16916d63.js";function sn(j){let r,T='Make sure to check out the Schedulers <a href="../../using-diffusers/schedulers">guide</a> to learn how to explore the tradeoff between scheduler speed and quality, and see the <a href="../../using-diffusers/loading#reuse-components-across-pipelines">reuse components across pipelines</a> section to learn how to efficiently load the same components into multiple pipelines.';return{c(){r=a("p"),r.innerHTML=T},l($){r=d($,"P",{"data-svelte-h":!0}),v(r)!=="svelte-1wmc0l4"&&(r.innerHTML=T)},m($,p){_($,r,p)},p:tt,d($){$&&o(r)}}}function on(j){let r,T="For audio diffusion:",$,p,b;return p=new Jt({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwSVB5dGhvbi5kaXNwbGF5JTIwaW1wb3J0JTIwQXVkaW8lMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwRGlmZnVzaW9uUGlwZWxpbmUlMEElMEFkZXZpY2UlMjAlM0QlMjAlMjJjdWRhJTIyJTIwaWYlMjB0b3JjaC5jdWRhLmlzX2F2YWlsYWJsZSgpJTIwZWxzZSUyMCUyMmNwdSUyMiUwQXBpcGUlMjAlM0QlMjBEaWZmdXNpb25QaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTIydGV0aWNpbyUyRmF1ZGlvLWRpZmZ1c2lvbi0yNTYlMjIpLnRvKGRldmljZSklMEElMEFvdXRwdXQlMjAlM0QlMjBwaXBlKCklMEFkaXNwbGF5KG91dHB1dC5pbWFnZXMlNUIwJTVEKSUwQWRpc3BsYXkoQXVkaW8ob3V0cHV0LmF1ZGlvcyU1QjAlNUQlMkMlMjByYXRlJTNEbWVsLmdldF9zYW1wbGVfcmF0ZSgpKSk=",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> IPython.display <span class="hljs-keyword">import</span> Audio
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline

device = <span class="hljs-string">&quot;cuda&quot;</span> <span class="hljs-keyword">if</span> torch.cuda.is_available() <span class="hljs-keyword">else</span> <span class="hljs-string">&quot;cpu&quot;</span>
pipe = DiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;teticio/audio-diffusion-256&quot;</span>).to(device)

output = pipe()
display(output.images[<span class="hljs-number">0</span>])
display(Audio(output.audios[<span class="hljs-number">0</span>], rate=mel.get_sample_rate()))`,wrap:!1}}),{c(){r=a("p"),r.textContent=T,$=s(),u(p.$$.fragment)},l(n){r=d(n,"P",{"data-svelte-h":!0}),v(r)!=="svelte-1smf6bg"&&(r.textContent=T),$=i(n),f(p.$$.fragment,n)},m(n,y){_(n,r,y),_(n,$,y),c(p,n,y),b=!0},p:tt,i(n){b||(m(p.$$.fragment,n),b=!0)},o(n){g(p.$$.fragment,n),b=!1},d(n){n&&(o(r),o($)),h(p,n)}}}function rn(j){let r,T="For latent audio diffusion:",$,p,b;return p=new Jt({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwSVB5dGhvbi5kaXNwbGF5JTIwaW1wb3J0JTIwQXVkaW8lMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwRGlmZnVzaW9uUGlwZWxpbmUlMEElMEFkZXZpY2UlMjAlM0QlMjAlMjJjdWRhJTIyJTIwaWYlMjB0b3JjaC5jdWRhLmlzX2F2YWlsYWJsZSgpJTIwZWxzZSUyMCUyMmNwdSUyMiUwQXBpcGUlMjAlM0QlMjBEaWZmdXNpb25QaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTIydGV0aWNpbyUyRmxhdGVudC1hdWRpby1kaWZmdXNpb24tMjU2JTIyKS50byhkZXZpY2UpJTBBJTBBb3V0cHV0JTIwJTNEJTIwcGlwZSgpJTBBZGlzcGxheShvdXRwdXQuaW1hZ2VzJTVCMCU1RCklMEFkaXNwbGF5KEF1ZGlvKG91dHB1dC5hdWRpb3MlNUIwJTVEJTJDJTIwcmF0ZSUzRHBpcGUubWVsLmdldF9zYW1wbGVfcmF0ZSgpKSk=",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> IPython.display <span class="hljs-keyword">import</span> Audio
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline

device = <span class="hljs-string">&quot;cuda&quot;</span> <span class="hljs-keyword">if</span> torch.cuda.is_available() <span class="hljs-keyword">else</span> <span class="hljs-string">&quot;cpu&quot;</span>
pipe = DiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;teticio/latent-audio-diffusion-256&quot;</span>).to(device)

output = pipe()
display(output.images[<span class="hljs-number">0</span>])
display(Audio(output.audios[<span class="hljs-number">0</span>], rate=pipe.mel.get_sample_rate()))`,wrap:!1}}),{c(){r=a("p"),r.textContent=T,$=s(),u(p.$$.fragment)},l(n){r=d(n,"P",{"data-svelte-h":!0}),v(r)!=="svelte-1tdalp8"&&(r.textContent=T),$=i(n),f(p.$$.fragment,n)},m(n,y){_(n,r,y),_(n,$,y),c(p,n,y),b=!0},p:tt,i(n){b||(m(p.$$.fragment,n),b=!0)},o(n){g(p.$$.fragment,n),b=!1},d(n){n&&(o(r),o($)),h(p,n)}}}function an(j){let r,T="For other tasks like variation, inpainting, outpainting, etc:",$,p,b;return p=new Jt({props:{code:"b3V0cHV0JTIwJTNEJTIwcGlwZSglMEElMjAlMjAlMjAlMjByYXdfYXVkaW8lM0RvdXRwdXQuYXVkaW9zJTVCMCUyQyUyMDAlNUQlMkMlMEElMjAlMjAlMjAlMjBzdGFydF9zdGVwJTNEaW50KHBpcGUuZ2V0X2RlZmF1bHRfc3RlcHMoKSUyMCUyRiUyMDIpJTJDJTBBJTIwJTIwJTIwJTIwbWFza19zdGFydF9zZWNzJTNEMSUyQyUwQSUyMCUyMCUyMCUyMG1hc2tfZW5kX3NlY3MlM0QxJTJDJTBBKSUwQWRpc3BsYXkob3V0cHV0LmltYWdlcyU1QjAlNUQpJTBBZGlzcGxheShBdWRpbyhvdXRwdXQuYXVkaW9zJTVCMCU1RCUyQyUyMHJhdGUlM0RwaXBlLm1lbC5nZXRfc2FtcGxlX3JhdGUoKSkp",highlighted:`output = pipe(
    raw_audio=output.audios[<span class="hljs-number">0</span>, <span class="hljs-number">0</span>],
    start_step=<span class="hljs-built_in">int</span>(pipe.get_default_steps() / <span class="hljs-number">2</span>),
    mask_start_secs=<span class="hljs-number">1</span>,
    mask_end_secs=<span class="hljs-number">1</span>,
)
display(output.images[<span class="hljs-number">0</span>])
display(Audio(output.audios[<span class="hljs-number">0</span>], rate=pipe.mel.get_sample_rate()))`,wrap:!1}}),{c(){r=a("p"),r.textContent=T,$=s(),u(p.$$.fragment)},l(n){r=d(n,"P",{"data-svelte-h":!0}),v(r)!=="svelte-1p5i2x8"&&(r.textContent=T),$=i(n),f(p.$$.fragment,n)},m(n,y){_(n,r,y),_(n,$,y),c(p,n,y),b=!0},p:tt,i(n){b||(m(p.$$.fragment,n),b=!0)},o(n){g(p.$$.fragment,n),b=!1},d(n){n&&(o(r),o($)),h(p,n)}}}function dn(j){let r,T,$,p,b,n,y,Ut='<a href="https://github.com/teticio/audio-diffusion" rel="nofollow">Audio Diffusion</a> is by Robert Dargavel Smith, and it leverages the recent advances in image generation from diffusion models by converting audio samples to and from Mel spectrogram images.',Ue,L,Le,q,Ge,w,Y,nt,he,Lt="Pipeline for audio diffusion.",st,_e,Gt=`This model inherits from <a href="/docs/diffusers/main/en/api/pipelines/overview#diffusers.DiffusionPipeline">DiffusionPipeline</a>. Check the superclass documentation for the generic methods
implemented for all pipelines (downloading, saving, running on a particular device, etc.).`,it,C,O,ot,$e,Nt="The call function to the pipeline for generation.",rt,be,Wt="Examples:",at,G,dt,N,lt,W,pt,E,H,ut,xe,Et="Reverse the denoising step process to recover a noisy image from the generated image.",ft,S,K,ct,ve,St="Returns default number of steps recommended for inference.",mt,V,ee,gt,ye,Vt="Spherical Linear intERPolation.",Ne,te,We,J,ne,ht,we,Zt="Output class for audio pipelines.",Ee,se,Se,U,ie,_t,Me,Xt="Output class for image pipelines.",Ve,oe,Ze,x,re,$t,Z,ae,bt,De,Bt="Convert slice of audio to spectrogram.",xt,X,de,vt,Pe,Rt="Get slice of audio.",yt,B,le,wt,Te,Ft="Get number of slices in audio.",Mt,R,pe,Dt,Ce,zt="Get sample rate.",Pt,F,ue,Tt,Ie,Qt="Converts spectrogram to audio.",Ct,z,fe,It,Ae,qt="Load audio.",At,Q,ce,kt,ke,Yt="Set resolution.",Xe,je,Be;return b=new Je({props:{title:"Audio Diffusion",local:"audio-diffusion",headingTag:"h1"}}),L=new nn({props:{$$slots:{default:[sn]},$$scope:{ctx:j}}}),q=new Je({props:{title:"AudioDiffusionPipeline",local:"diffusers.AudioDiffusionPipeline",headingTag:"h2"}}),Y=new k({props:{name:"class diffusers.AudioDiffusionPipeline",anchor:"diffusers.AudioDiffusionPipeline",parameters:[{name:"vqvae",val:": AutoencoderKL"},{name:"unet",val:": UNet2DConditionModel"},{name:"mel",val:": Mel"},{name:"scheduler",val:": typing.Union[diffusers.schedulers.scheduling_ddim.DDIMScheduler, diffusers.schedulers.scheduling_ddpm.DDPMScheduler]"}],parametersDescription:[{anchor:"diffusers.AudioDiffusionPipeline.vqae",description:`<strong>vqae</strong> (<a href="/docs/diffusers/main/en/api/models/autoencoderkl#diffusers.AutoencoderKL">AutoencoderKL</a>) &#x2014;
Variational Auto-Encoder (VAE) model to encode and decode images to and from latent representations.`,name:"vqae"},{anchor:"diffusers.AudioDiffusionPipeline.unet",description:`<strong>unet</strong> (<a href="/docs/diffusers/main/en/api/models/unet2d-cond#diffusers.UNet2DConditionModel">UNet2DConditionModel</a>) &#x2014;
A <code>UNet2DConditionModel</code> to denoise the encoded image latents.`,name:"unet"},{anchor:"diffusers.AudioDiffusionPipeline.mel",description:`<strong>mel</strong> (<a href="/docs/diffusers/main/en/api/pipelines/audio_diffusion#diffusers.Mel">Mel</a>) &#x2014;
Transform audio into a spectrogram.`,name:"mel"},{anchor:"diffusers.AudioDiffusionPipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/main/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a> or <a href="/docs/diffusers/main/en/api/schedulers/ddpm#diffusers.DDPMScheduler">DDPMScheduler</a>) &#x2014;
A scheduler to be used in combination with <code>unet</code> to denoise the encoded image latents. Can be one of
<a href="/docs/diffusers/main/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a> or <a href="/docs/diffusers/main/en/api/schedulers/ddpm#diffusers.DDPMScheduler">DDPMScheduler</a>.`,name:"scheduler"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/audio_diffusion/pipeline_audio_diffusion.py#L30"}}),O=new k({props:{name:"__call__",anchor:"diffusers.AudioDiffusionPipeline.__call__",parameters:[{name:"batch_size",val:": int = 1"},{name:"audio_file",val:": str = None"},{name:"raw_audio",val:": ndarray = None"},{name:"slice",val:": int = 0"},{name:"start_step",val:": int = 0"},{name:"steps",val:": int = None"},{name:"generator",val:": Generator = None"},{name:"mask_start_secs",val:": float = 0"},{name:"mask_end_secs",val:": float = 0"},{name:"step_generator",val:": Generator = None"},{name:"eta",val:": float = 0"},{name:"noise",val:": Tensor = None"},{name:"encoding",val:": Tensor = None"},{name:"return_dict",val:" = True"}],parametersDescription:[{anchor:"diffusers.AudioDiffusionPipeline.__call__.batch_size",description:`<strong>batch_size</strong> (<code>int</code>) &#x2014;
Number of samples to generate.`,name:"batch_size"},{anchor:"diffusers.AudioDiffusionPipeline.__call__.audio_file",description:`<strong>audio_file</strong> (<code>str</code>) &#x2014;
An audio file that must be on disk due to <a href="https://librosa.org/" rel="nofollow">Librosa</a> limitation.`,name:"audio_file"},{anchor:"diffusers.AudioDiffusionPipeline.__call__.raw_audio",description:`<strong>raw_audio</strong> (<code>np.ndarray</code>) &#x2014;
The raw audio file as a NumPy array.`,name:"raw_audio"},{anchor:"diffusers.AudioDiffusionPipeline.__call__.slice",description:`<strong>slice</strong> (<code>int</code>) &#x2014;
Slice number of audio to convert.`,name:"slice"},{anchor:"diffusers.AudioDiffusionPipeline.__call__.start_step",description:`<strong>start_step</strong> (int) &#x2014;
Step to start diffusion from.`,name:"start_step"},{anchor:"diffusers.AudioDiffusionPipeline.__call__.steps",description:`<strong>steps</strong> (<code>int</code>) &#x2014;
Number of denoising steps (defaults to <code>50</code> for DDIM and <code>1000</code> for DDPM).`,name:"steps"},{anchor:"diffusers.AudioDiffusionPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code>) &#x2014;
A <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow"><code>torch.Generator</code></a> to make
generation deterministic.`,name:"generator"},{anchor:"diffusers.AudioDiffusionPipeline.__call__.mask_start_secs",description:`<strong>mask_start_secs</strong> (<code>float</code>) &#x2014;
Number of seconds of audio to mask (not generate) at start.`,name:"mask_start_secs"},{anchor:"diffusers.AudioDiffusionPipeline.__call__.mask_end_secs",description:`<strong>mask_end_secs</strong> (<code>float</code>) &#x2014;
Number of seconds of audio to mask (not generate) at end.`,name:"mask_end_secs"},{anchor:"diffusers.AudioDiffusionPipeline.__call__.step_generator",description:`<strong>step_generator</strong> (<code>torch.Generator</code>) &#x2014;
A <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow"><code>torch.Generator</code></a> used to denoise.
None`,name:"step_generator"},{anchor:"diffusers.AudioDiffusionPipeline.__call__.eta",description:`<strong>eta</strong> (<code>float</code>) &#x2014;
Corresponds to parameter eta (&#x3B7;) from the <a href="https://arxiv.org/abs/2010.02502" rel="nofollow">DDIM</a> paper. Only applies
to the <a href="/docs/diffusers/main/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>, and is ignored in other schedulers.`,name:"eta"},{anchor:"diffusers.AudioDiffusionPipeline.__call__.noise",description:`<strong>noise</strong> (<code>torch.Tensor</code>) &#x2014;
A noise tensor of shape <code>(batch_size, 1, height, width)</code> or <code>None</code>.`,name:"noise"},{anchor:"diffusers.AudioDiffusionPipeline.__call__.encoding",description:`<strong>encoding</strong> (<code>torch.Tensor</code>) &#x2014;
A tensor for <a href="/docs/diffusers/main/en/api/models/unet2d-cond#diffusers.UNet2DConditionModel">UNet2DConditionModel</a> of shape <code>(batch_size, seq_length, cross_attention_dim)</code>.`,name:"encoding"},{anchor:"diffusers.AudioDiffusionPipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>) &#x2014;
Whether or not to return a <a href="/docs/diffusers/main/en/api/pipelines/spectrogram_diffusion#diffusers.AudioPipelineOutput">AudioPipelineOutput</a>, <a href="/docs/diffusers/main/en/api/pipelines/ddim#diffusers.ImagePipelineOutput">ImagePipelineOutput</a> or a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/audio_diffusion/pipeline_audio_diffusion.py#L70",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A list of Mel spectrograms (<code>float</code>, <code>List[np.ndarray]</code>) with the sample rate and raw audio.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>List[PIL Image]</code></p>
`}}),G=new jt({props:{anchor:"diffusers.AudioDiffusionPipeline.__call__.example",$$slots:{default:[on]},$$scope:{ctx:j}}}),N=new jt({props:{anchor:"diffusers.AudioDiffusionPipeline.__call__.example-2",$$slots:{default:[rn]},$$scope:{ctx:j}}}),W=new jt({props:{anchor:"diffusers.AudioDiffusionPipeline.__call__.example-3",$$slots:{default:[an]},$$scope:{ctx:j}}}),H=new k({props:{name:"encode",anchor:"diffusers.AudioDiffusionPipeline.encode",parameters:[{name:"images",val:": typing.List[PIL.Image.Image]"},{name:"steps",val:": int = 50"}],parametersDescription:[{anchor:"diffusers.AudioDiffusionPipeline.encode.images",description:`<strong>images</strong> (<code>List[PIL Image]</code>) &#x2014;
List of images to encode.`,name:"images"},{anchor:"diffusers.AudioDiffusionPipeline.encode.steps",description:`<strong>steps</strong> (<code>int</code>) &#x2014;
Number of encoding steps to perform (defaults to <code>50</code>).`,name:"steps"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/audio_diffusion/pipeline_audio_diffusion.py#L270",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A noise tensor of shape <code>(batch_size, 1, height, width)</code>.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>np.ndarray</code></p>
`}}),K=new k({props:{name:"get_default_steps",anchor:"diffusers.AudioDiffusionPipeline.get_default_steps",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/audio_diffusion/pipeline_audio_diffusion.py#L61",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>The number of steps.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>int</code></p>
`}}),ee=new k({props:{name:"slerp",anchor:"diffusers.AudioDiffusionPipeline.slerp",parameters:[{name:"x0",val:": Tensor"},{name:"x1",val:": Tensor"},{name:"alpha",val:": float"}],parametersDescription:[{anchor:"diffusers.AudioDiffusionPipeline.slerp.x0",description:`<strong>x0</strong> (<code>torch.Tensor</code>) &#x2014;
The first tensor to interpolate between.`,name:"x0"},{anchor:"diffusers.AudioDiffusionPipeline.slerp.x1",description:`<strong>x1</strong> (<code>torch.Tensor</code>) &#x2014;
Second tensor to interpolate between.`,name:"x1"},{anchor:"diffusers.AudioDiffusionPipeline.slerp.alpha",description:`<strong>alpha</strong> (<code>float</code>) &#x2014;
Interpolation between 0 and 1`,name:"alpha"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/audio_diffusion/pipeline_audio_diffusion.py#L311",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>The interpolated tensor.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>torch.Tensor</code></p>
`}}),te=new Je({props:{title:"AudioPipelineOutput",local:"diffusers.AudioPipelineOutput",headingTag:"h2"}}),ne=new k({props:{name:"class diffusers.AudioPipelineOutput",anchor:"diffusers.AudioPipelineOutput",parameters:[{name:"audios",val:": ndarray"}],parametersDescription:[{anchor:"diffusers.AudioPipelineOutput.audios",description:`<strong>audios</strong> (<code>np.ndarray</code>) &#x2014;
List of denoised audio samples of a NumPy array of shape <code>(batch_size, num_channels, sample_rate)</code>.`,name:"audios"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/pipeline_utils.py#L125"}}),se=new Je({props:{title:"ImagePipelineOutput",local:"diffusers.ImagePipelineOutput",headingTag:"h2"}}),ie=new k({props:{name:"class diffusers.ImagePipelineOutput",anchor:"diffusers.ImagePipelineOutput",parameters:[{name:"images",val:": typing.Union[typing.List[PIL.Image.Image], numpy.ndarray]"}],parametersDescription:[{anchor:"diffusers.ImagePipelineOutput.images",description:`<strong>images</strong> (<code>List[PIL.Image.Image]</code> or <code>np.ndarray</code>) &#x2014;
List of denoised PIL images of length <code>batch_size</code> or NumPy array of shape <code>(batch_size, height, width, num_channels)</code>.`,name:"images"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/pipeline_utils.py#L111"}}),oe=new Je({props:{title:"Mel",local:"diffusers.Mel",headingTag:"h2"}}),re=new k({props:{name:"class diffusers.Mel",anchor:"diffusers.Mel",parameters:[{name:"x_res",val:": int = 256"},{name:"y_res",val:": int = 256"},{name:"sample_rate",val:": int = 22050"},{name:"n_fft",val:": int = 2048"},{name:"hop_length",val:": int = 512"},{name:"top_db",val:": int = 80"},{name:"n_iter",val:": int = 32"}],parametersDescription:[{anchor:"diffusers.Mel.x_res",description:`<strong>x_res</strong> (<code>int</code>) &#x2014;
x resolution of spectrogram (time).`,name:"x_res"},{anchor:"diffusers.Mel.y_res",description:`<strong>y_res</strong> (<code>int</code>) &#x2014;
y resolution of spectrogram (frequency bins).`,name:"y_res"},{anchor:"diffusers.Mel.sample_rate",description:`<strong>sample_rate</strong> (<code>int</code>) &#x2014;
Sample rate of audio.`,name:"sample_rate"},{anchor:"diffusers.Mel.n_fft",description:`<strong>n_fft</strong> (<code>int</code>) &#x2014;
Number of Fast Fourier Transforms.`,name:"n_fft"},{anchor:"diffusers.Mel.hop_length",description:`<strong>hop_length</strong> (<code>int</code>) &#x2014;
Hop length (a higher number is recommended if <code>y_res</code> &lt; 256).`,name:"hop_length"},{anchor:"diffusers.Mel.top_db",description:`<strong>top_db</strong> (<code>int</code>) &#x2014;
Loudest decibel value.`,name:"top_db"},{anchor:"diffusers.Mel.n_iter",description:`<strong>n_iter</strong> (<code>int</code>) &#x2014;
Number of iterations for Griffin-Lim Mel inversion.`,name:"n_iter"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/audio_diffusion/mel.py#L37"}}),ae=new k({props:{name:"audio_slice_to_image",anchor:"diffusers.Mel.audio_slice_to_image",parameters:[{name:"slice",val:": int"}],parametersDescription:[{anchor:"diffusers.Mel.audio_slice_to_image.slice",description:`<strong>slice</strong> (<code>int</code>) &#x2014;
Slice number of audio to convert (out of <code>get_number_of_slices()</code>).`,name:"slice"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/audio_diffusion/mel.py#L143",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A grayscale image of <code>x_res x y_res</code>.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>PIL Image</code></p>
`}}),de=new k({props:{name:"get_audio_slice",anchor:"diffusers.Mel.get_audio_slice",parameters:[{name:"slice",val:": int = 0"}],parametersDescription:[{anchor:"diffusers.Mel.get_audio_slice.slice",description:`<strong>slice</strong> (<code>int</code>) &#x2014;
Slice number of audio (out of <code>get_number_of_slices()</code>).`,name:"slice"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/audio_diffusion/mel.py#L121",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>The audio slice as a NumPy array.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>np.ndarray</code></p>
`}}),le=new k({props:{name:"get_number_of_slices",anchor:"diffusers.Mel.get_number_of_slices",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/audio_diffusion/mel.py#L112",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>Number of spectograms audio can be sliced into.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>int</code></p>
`}}),pe=new k({props:{name:"get_sample_rate",anchor:"diffusers.Mel.get_sample_rate",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/audio_diffusion/mel.py#L134",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>Sample rate of audio.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>int</code></p>
`}}),ue=new k({props:{name:"image_to_audio",anchor:"diffusers.Mel.image_to_audio",parameters:[{name:"image",val:": Image"}],parametersDescription:[{anchor:"diffusers.Mel.image_to_audio.image",description:`<strong>image</strong> (<code>PIL Image</code>) &#x2014;
An grayscale image of <code>x_res x y_res</code>.`,name:"image"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/audio_diffusion/mel.py#L162",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>The audio as a NumPy array.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p>audio (<code>np.ndarray</code>)</p>
`}}),fe=new k({props:{name:"load_audio",anchor:"diffusers.Mel.load_audio",parameters:[{name:"audio_file",val:": str = None"},{name:"raw_audio",val:": ndarray = None"}],parametersDescription:[{anchor:"diffusers.Mel.load_audio.audio_file",description:`<strong>audio_file</strong> (<code>str</code>) &#x2014;
An audio file that must be on disk due to <a href="https://librosa.org/" rel="nofollow">Librosa</a> limitation.`,name:"audio_file"},{anchor:"diffusers.Mel.load_audio.raw_audio",description:`<strong>raw_audio</strong> (<code>np.ndarray</code>) &#x2014;
The raw audio file as a NumPy array.`,name:"raw_audio"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/audio_diffusion/mel.py#L94"}}),ce=new k({props:{name:"set_resolution",anchor:"diffusers.Mel.set_resolution",parameters:[{name:"x_res",val:": int"},{name:"y_res",val:": int"}],parametersDescription:[{anchor:"diffusers.Mel.set_resolution.x_res",description:`<strong>x_res</strong> (<code>int</code>) &#x2014;
x resolution of spectrogram (time).`,name:"x_res"},{anchor:"diffusers.Mel.set_resolution.y_res",description:`<strong>y_res</strong> (<code>int</code>) &#x2014;
y resolution of spectrogram (frequency bins).`,name:"y_res"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/audio_diffusion/mel.py#L80"}}),{c(){r=a("meta"),T=s(),$=a("p"),p=s(),u(b.$$.fragment),n=s(),y=a("p"),y.innerHTML=Ut,Ue=s(),u(L.$$.fragment),Le=s(),u(q.$$.fragment),Ge=s(),w=a("div"),u(Y.$$.fragment),nt=s(),he=a("p"),he.textContent=Lt,st=s(),_e=a("p"),_e.innerHTML=Gt,it=s(),C=a("div"),u(O.$$.fragment),ot=s(),$e=a("p"),$e.textContent=Nt,rt=s(),be=a("p"),be.textContent=Wt,at=s(),u(G.$$.fragment),dt=s(),u(N.$$.fragment),lt=s(),u(W.$$.fragment),pt=s(),E=a("div"),u(H.$$.fragment),ut=s(),xe=a("p"),xe.textContent=Et,ft=s(),S=a("div"),u(K.$$.fragment),ct=s(),ve=a("p"),ve.textContent=St,mt=s(),V=a("div"),u(ee.$$.fragment),gt=s(),ye=a("p"),ye.textContent=Vt,Ne=s(),u(te.$$.fragment),We=s(),J=a("div"),u(ne.$$.fragment),ht=s(),we=a("p"),we.textContent=Zt,Ee=s(),u(se.$$.fragment),Se=s(),U=a("div"),u(ie.$$.fragment),_t=s(),Me=a("p"),Me.textContent=Xt,Ve=s(),u(oe.$$.fragment),Ze=s(),x=a("div"),u(re.$$.fragment),$t=s(),Z=a("div"),u(ae.$$.fragment),bt=s(),De=a("p"),De.textContent=Bt,xt=s(),X=a("div"),u(de.$$.fragment),vt=s(),Pe=a("p"),Pe.textContent=Rt,yt=s(),B=a("div"),u(le.$$.fragment),wt=s(),Te=a("p"),Te.textContent=Ft,Mt=s(),R=a("div"),u(pe.$$.fragment),Dt=s(),Ce=a("p"),Ce.textContent=zt,Pt=s(),F=a("div"),u(ue.$$.fragment),Tt=s(),Ie=a("p"),Ie.textContent=Qt,Ct=s(),z=a("div"),u(fe.$$.fragment),It=s(),Ae=a("p"),Ae.textContent=qt,At=s(),Q=a("div"),u(ce.$$.fragment),kt=s(),ke=a("p"),ke.textContent=Yt,Xe=s(),je=a("p"),this.h()},l(e){const l=tn("svelte-u9bgzb",document.head);r=d(l,"META",{name:!0,content:!0}),l.forEach(o),T=i(e),$=d(e,"P",{}),D($).forEach(o),p=i(e),f(b.$$.fragment,e),n=i(e),y=d(e,"P",{"data-svelte-h":!0}),v(y)!=="svelte-ry2ql6"&&(y.innerHTML=Ut),Ue=i(e),f(L.$$.fragment,e),Le=i(e),f(q.$$.fragment,e),Ge=i(e),w=d(e,"DIV",{class:!0});var M=D(w);f(Y.$$.fragment,M),nt=i(M),he=d(M,"P",{"data-svelte-h":!0}),v(he)!=="svelte-85kq2u"&&(he.textContent=Lt),st=i(M),_e=d(M,"P",{"data-svelte-h":!0}),v(_e)!=="svelte-496sm0"&&(_e.innerHTML=Gt),it=i(M),C=d(M,"DIV",{class:!0});var A=D(C);f(O.$$.fragment,A),ot=i(A),$e=d(A,"P",{"data-svelte-h":!0}),v($e)!=="svelte-50j04k"&&($e.textContent=Nt),rt=i(A),be=d(A,"P",{"data-svelte-h":!0}),v(be)!=="svelte-kvfsh7"&&(be.textContent=Wt),at=i(A),f(G.$$.fragment,A),dt=i(A),f(N.$$.fragment,A),lt=i(A),f(W.$$.fragment,A),A.forEach(o),pt=i(M),E=d(M,"DIV",{class:!0});var me=D(E);f(H.$$.fragment,me),ut=i(me),xe=d(me,"P",{"data-svelte-h":!0}),v(xe)!=="svelte-lh0ubq"&&(xe.textContent=Et),me.forEach(o),ft=i(M),S=d(M,"DIV",{class:!0});var ge=D(S);f(K.$$.fragment,ge),ct=i(ge),ve=d(ge,"P",{"data-svelte-h":!0}),v(ve)!=="svelte-1hid80u"&&(ve.textContent=St),ge.forEach(o),mt=i(M),V=d(M,"DIV",{class:!0});var Re=D(V);f(ee.$$.fragment,Re),gt=i(Re),ye=d(Re,"P",{"data-svelte-h":!0}),v(ye)!=="svelte-168tp9o"&&(ye.textContent=Vt),Re.forEach(o),M.forEach(o),Ne=i(e),f(te.$$.fragment,e),We=i(e),J=d(e,"DIV",{class:!0});var Fe=D(J);f(ne.$$.fragment,Fe),ht=i(Fe),we=d(Fe,"P",{"data-svelte-h":!0}),v(we)!=="svelte-19ryw33"&&(we.textContent=Zt),Fe.forEach(o),Ee=i(e),f(se.$$.fragment,e),Se=i(e),U=d(e,"DIV",{class:!0});var ze=D(U);f(ie.$$.fragment,ze),_t=i(ze),Me=d(ze,"P",{"data-svelte-h":!0}),v(Me)!=="svelte-19wetgi"&&(Me.textContent=Xt),ze.forEach(o),Ve=i(e),f(oe.$$.fragment,e),Ze=i(e),x=d(e,"DIV",{class:!0});var I=D(x);f(re.$$.fragment,I),$t=i(I),Z=d(I,"DIV",{class:!0});var Qe=D(Z);f(ae.$$.fragment,Qe),bt=i(Qe),De=d(Qe,"P",{"data-svelte-h":!0}),v(De)!=="svelte-q43x8u"&&(De.textContent=Bt),Qe.forEach(o),xt=i(I),X=d(I,"DIV",{class:!0});var qe=D(X);f(de.$$.fragment,qe),vt=i(qe),Pe=d(qe,"P",{"data-svelte-h":!0}),v(Pe)!=="svelte-1nkpff9"&&(Pe.textContent=Rt),qe.forEach(o),yt=i(I),B=d(I,"DIV",{class:!0});var Ye=D(B);f(le.$$.fragment,Ye),wt=i(Ye),Te=d(Ye,"P",{"data-svelte-h":!0}),v(Te)!=="svelte-1enf83g"&&(Te.textContent=Ft),Ye.forEach(o),Mt=i(I),R=d(I,"DIV",{class:!0});var Oe=D(R);f(pe.$$.fragment,Oe),Dt=i(Oe),Ce=d(Oe,"P",{"data-svelte-h":!0}),v(Ce)!=="svelte-6fjj2"&&(Ce.textContent=zt),Oe.forEach(o),Pt=i(I),F=d(I,"DIV",{class:!0});var He=D(F);f(ue.$$.fragment,He),Tt=i(He),Ie=d(He,"P",{"data-svelte-h":!0}),v(Ie)!=="svelte-15e67jm"&&(Ie.textContent=Qt),He.forEach(o),Ct=i(I),z=d(I,"DIV",{class:!0});var Ke=D(z);f(fe.$$.fragment,Ke),It=i(Ke),Ae=d(Ke,"P",{"data-svelte-h":!0}),v(Ae)!=="svelte-1j27adc"&&(Ae.textContent=qt),Ke.forEach(o),At=i(I),Q=d(I,"DIV",{class:!0});var et=D(Q);f(ce.$$.fragment,et),kt=i(et),ke=d(et,"P",{"data-svelte-h":!0}),v(ke)!=="svelte-v0dk8k"&&(ke.textContent=Yt),et.forEach(o),I.forEach(o),Xe=i(e),je=d(e,"P",{}),D(je).forEach(o),this.h()},h(){P(r,"name","hf:doc:metadata"),P(r,"content",ln),P(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),P(E,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),P(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),P(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),P(w,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),P(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),P(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),P(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),P(X,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),P(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),P(R,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),P(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),P(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),P(Q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),P(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,l){t(document.head,r),_(e,T,l),_(e,$,l),_(e,p,l),c(b,e,l),_(e,n,l),_(e,y,l),_(e,Ue,l),c(L,e,l),_(e,Le,l),c(q,e,l),_(e,Ge,l),_(e,w,l),c(Y,w,null),t(w,nt),t(w,he),t(w,st),t(w,_e),t(w,it),t(w,C),c(O,C,null),t(C,ot),t(C,$e),t(C,rt),t(C,be),t(C,at),c(G,C,null),t(C,dt),c(N,C,null),t(C,lt),c(W,C,null),t(w,pt),t(w,E),c(H,E,null),t(E,ut),t(E,xe),t(w,ft),t(w,S),c(K,S,null),t(S,ct),t(S,ve),t(w,mt),t(w,V),c(ee,V,null),t(V,gt),t(V,ye),_(e,Ne,l),c(te,e,l),_(e,We,l),_(e,J,l),c(ne,J,null),t(J,ht),t(J,we),_(e,Ee,l),c(se,e,l),_(e,Se,l),_(e,U,l),c(ie,U,null),t(U,_t),t(U,Me),_(e,Ve,l),c(oe,e,l),_(e,Ze,l),_(e,x,l),c(re,x,null),t(x,$t),t(x,Z),c(ae,Z,null),t(Z,bt),t(Z,De),t(x,xt),t(x,X),c(de,X,null),t(X,vt),t(X,Pe),t(x,yt),t(x,B),c(le,B,null),t(B,wt),t(B,Te),t(x,Mt),t(x,R),c(pe,R,null),t(R,Dt),t(R,Ce),t(x,Pt),t(x,F),c(ue,F,null),t(F,Tt),t(F,Ie),t(x,Ct),t(x,z),c(fe,z,null),t(z,It),t(z,Ae),t(x,At),t(x,Q),c(ce,Q,null),t(Q,kt),t(Q,ke),_(e,Xe,l),_(e,je,l),Be=!0},p(e,[l]){const M={};l&2&&(M.$$scope={dirty:l,ctx:e}),L.$set(M);const A={};l&2&&(A.$$scope={dirty:l,ctx:e}),G.$set(A);const me={};l&2&&(me.$$scope={dirty:l,ctx:e}),N.$set(me);const ge={};l&2&&(ge.$$scope={dirty:l,ctx:e}),W.$set(ge)},i(e){Be||(m(b.$$.fragment,e),m(L.$$.fragment,e),m(q.$$.fragment,e),m(Y.$$.fragment,e),m(O.$$.fragment,e),m(G.$$.fragment,e),m(N.$$.fragment,e),m(W.$$.fragment,e),m(H.$$.fragment,e),m(K.$$.fragment,e),m(ee.$$.fragment,e),m(te.$$.fragment,e),m(ne.$$.fragment,e),m(se.$$.fragment,e),m(ie.$$.fragment,e),m(oe.$$.fragment,e),m(re.$$.fragment,e),m(ae.$$.fragment,e),m(de.$$.fragment,e),m(le.$$.fragment,e),m(pe.$$.fragment,e),m(ue.$$.fragment,e),m(fe.$$.fragment,e),m(ce.$$.fragment,e),Be=!0)},o(e){g(b.$$.fragment,e),g(L.$$.fragment,e),g(q.$$.fragment,e),g(Y.$$.fragment,e),g(O.$$.fragment,e),g(G.$$.fragment,e),g(N.$$.fragment,e),g(W.$$.fragment,e),g(H.$$.fragment,e),g(K.$$.fragment,e),g(ee.$$.fragment,e),g(te.$$.fragment,e),g(ne.$$.fragment,e),g(se.$$.fragment,e),g(ie.$$.fragment,e),g(oe.$$.fragment,e),g(re.$$.fragment,e),g(ae.$$.fragment,e),g(de.$$.fragment,e),g(le.$$.fragment,e),g(pe.$$.fragment,e),g(ue.$$.fragment,e),g(fe.$$.fragment,e),g(ce.$$.fragment,e),Be=!1},d(e){e&&(o(T),o($),o(p),o(n),o(y),o(Ue),o(Le),o(Ge),o(w),o(Ne),o(We),o(J),o(Ee),o(Se),o(U),o(Ve),o(Ze),o(x),o(Xe),o(je)),o(r),h(b,e),h(L,e),h(q,e),h(Y),h(O),h(G),h(N),h(W),h(H),h(K),h(ee),h(te,e),h(ne),h(se,e),h(ie),h(oe,e),h(re),h(ae),h(de),h(le),h(pe),h(ue),h(fe),h(ce)}}}const ln='{"title":"Audio Diffusion","local":"audio-diffusion","sections":[{"title":"AudioDiffusionPipeline","local":"diffusers.AudioDiffusionPipeline","sections":[],"depth":2},{"title":"AudioPipelineOutput","local":"diffusers.AudioPipelineOutput","sections":[],"depth":2},{"title":"ImagePipelineOutput","local":"diffusers.ImagePipelineOutput","sections":[],"depth":2},{"title":"Mel","local":"diffusers.Mel","sections":[],"depth":2}],"depth":1}';function pn(j){return Ht(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class $n extends Kt{constructor(r){super(),en(this,r,pn,dn,Ot,{})}}export{$n as component};
